From 478254e134a2a85ebb5d12235a1286546a9306a1 Mon Sep 17 00:00:00 2001 From: Pujit Mehrotra Date: Fri, 13 Dec 2024 11:16:09 -0500 Subject: [PATCH] feat(web): rm old notification bell upon plugin installation (#979) * feat(web): rm old notification bell upon plugin installation * refactor: use grep flag to unescape regex operator * fix: preserve DefaultPageLayout.php --- plugin/plugins/dynamix.unraid.net.plg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin/plugins/dynamix.unraid.net.plg b/plugin/plugins/dynamix.unraid.net.plg index 58c29bb1b..dc131b05e 100755 --- a/plugin/plugins/dynamix.unraid.net.plg +++ b/plugin/plugins/dynamix.unraid.net.plg @@ -466,6 +466,7 @@ preserveFilesDirs=( "move:/usr/local/emhttp/plugins/dynamix.my.servers/data/server-state.php:preventDowngrade" "move:/usr/local/emhttp/plugins/dynamix.my.servers/include/reboot-details.php:preventDowngrade" "move:/usr/local/emhttp/plugins/dynamix.my.servers/include/translations.php:preventDowngrade" + "copy:/usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php:preventDowngrade" ) preserveAction() { @@ -516,6 +517,13 @@ if [[ -n $LINENUM ]]; then mv -f "$FILE~" "$FILE" fi +# Remove lines containing id='bell' or #bell and write to intermediate temporary file. +# This effectively removes the old notification bell from the webgui (via DefaultPageLayout.php). +TMP_FILE=$(mktemp) +grep -Ev "id='bell'|#bell" "$FILE" > "$TMP_FILE" +mv "$TMP_FILE" "$FILE" +echo "Removed notification-bell-related lines from $FILE" + # patch: showchanges, starting with 6.11.0-rc1 # ShowChanges.php, in 6.10 # search text: $valid = ['/var/tmp/','/tmp/plugins/'];