library.sh: Have notify_admin notify *all* admins, not just the first

1.51.0.sh: clear opcache after removing php-json, notify users if php8.2 packages need to be removed

Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias Knöppler 2023-01-18 02:47:57 +01:00
parent 92698aa028
commit f09ccf26ce
No known key found for this signature in database
GPG Key ID: 3510056072886A8F
2 changed files with 22 additions and 4 deletions

View File

@ -543,9 +543,12 @@ function notify_admin()
{
local header="$1"
local msg="$2"
local admin=$(mysql -u root nextcloud -Nse "select uid from oc_group_user where gid='admin' limit 1;")
[[ "${admin}" == "" ]] && { echo "admin user not found" >&2; return 0; }
ncc notification:generate "${admin}" "${header}" -l "${msg}" || true
local admins=$(mysql -u root nextcloud -Nse "select uid from oc_group_user where gid='admin';")
[[ "${admins}" == "" ]] && { echo "admin user not found" >&2; return 0; }
while read -r admin
do
ncc notification:generate "${admin}" "${header}" -l "${msg}" || true
done <<<"$admins"
}
function save_maintenance_mode()

View File

@ -1,3 +1,18 @@
#!/bin/bash
apt-get remove -y php-json || true
set -e
source /usr/local/etc/library.sh
dpkg -l | grep -e '^ii' | grep -e 'php-json' > /dev/null && {
apt-get remove -y php-json
run_app "clear-php-opcache"
}
dpkg -l | grep -e '^ii' | grep -e 'php8.2' > /dev/null && {
msg="PHP 8.2 packages have been detected on your ncp instance, which could cause issues. If you didn't install them on purpose, please remove them with the following command: sudo apt remove php8.2-*"
echo -e "$msg"
notify_admin "NextcloudPi" "$msg"
}
exit 0