From f09ccf26ce8904efdcba6644b05da75f5ab1838d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Wed, 18 Jan 2023 02:47:57 +0100 Subject: [PATCH] library.sh: Have notify_admin notify *all* admins, not just the first MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- etc/library.sh | 9 ++++++--- updates/1.51.0.sh | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/etc/library.sh b/etc/library.sh index 46d5265d..4eab4c20 100644 --- a/etc/library.sh +++ b/etc/library.sh @@ -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() diff --git a/updates/1.51.0.sh b/updates/1.51.0.sh index df137295..2a1bdf51 100644 --- a/updates/1.51.0.sh +++ b/updates/1.51.0.sh @@ -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