disable maintenance mode for no_check as well

Signed-off-by: Daniel Hansson <mailto@danielhansson.nu>
This commit is contained in:
Daniel Hansson 2023-07-28 12:03:30 +02:00 committed by GitHub
parent b844a7523b
commit a1fdaf06ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

13
lib.sh
View File

@ -1197,7 +1197,20 @@ fi
# Example: nextcloud_occ_no_check 'maintenance:mode --on'
nextcloud_occ_no_check() {
# Disable maintenance mode if enabled to be able to perform db task and notify
if sudo -u www-data php "$NCPATH"/occ maintenance:mode | grep enabled
then
sudo -u www-data php "$NCPATH"/occ maintenance:mode --off
MMODE=enabled
fi
# Run the actual command
sudo -u www-data php "$NCPATH"/occ "$@";
# Enable maintenance:mode again if it was enabled when running this function
if [ -n "$MMODE" ]
then
sudo -u www-data php "$NCPATH"/occ maintenance:mode --on
unset MMODE
fi
}
# Backwards compatibility (2020-10-08)