Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable maintenance mode if active during occ #2530

Merged
merged 3 commits into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,20 @@ fi

# Example: nextcloud_occ 'maintenance:mode --on'
nextcloud_occ() {
# 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
check_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
}

# Example: nextcloud_occ_no_check 'maintenance:mode --on'
Expand Down