mirror of
https://github.com/unraid/webgui.git
synced 2026-01-05 17:20:04 -06:00
23 lines
641 B
PHP
Executable File
23 lines
641 B
PHP
Executable File
#!/usr/bin/php -q
|
|
<?PHP
|
|
$cfg = '/boot/config/favorites.cfg';
|
|
if (!file_exists($cfg)) exit(0);
|
|
|
|
$file = fopen($cfg,'r');
|
|
while (($page = fgets($file))!==false) {
|
|
// update each favorite
|
|
$page = rtrim($page);
|
|
$line = fopen($page,'r');
|
|
if ($line === false) continue;
|
|
// get current Menu settings
|
|
extract(parse_ini_string(fgets($line)));
|
|
fclose($line);
|
|
// remove and re-add label and escape single quotes for sed command
|
|
$Menu = str_replace([' MyFavorites',"'"],['',"'\''"],$Menu).' MyFavorites';
|
|
// update Menu settings
|
|
exec("sed -ri '0,/^Menu=\".+\"$/s//Menu=\"$Menu\"/' $page 2>/dev/null");
|
|
}
|
|
fclose($file);
|
|
exit(0);
|
|
?>
|