mirror of
https://github.com/unraid/webgui.git
synced 2026-03-09 04:21:27 -05:00
Restore favorites on reboot
This commit is contained in:
21
emhttp/plugins/dynamix/scripts/restore_favorites
Normal file
21
emhttp/plugins/dynamix/scripts/restore_favorites
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/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');
|
||||
// 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);
|
||||
?>
|
||||
Reference in New Issue
Block a user