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
This commit is contained in:
Pujit Mehrotra
2024-12-13 11:16:09 -05:00
committed by GitHub
parent 8f5814589e
commit 478254e134

View File

@@ -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/'];