mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Merge pull request #271 from YunoHost-Apps/disable_maintenance
Add an action to disable maintenance mode
This commit is contained in:
commit
6883bd908d
2 changed files with 60 additions and 0 deletions
8
actions.toml
Normal file
8
actions.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[disable_maintenance]
|
||||
name = "Disable the maintenance mode of Nextcloud"
|
||||
command = "/bin/bash scripts/actions/disable_maintenance"
|
||||
# user = "root" # optional
|
||||
# cwd = "/" # optional
|
||||
# accepted_return_codes = [0, 1, 2, 3] # optional
|
||||
accepted_return_codes = [0]
|
||||
description = "Disable the maintenance mode of Nextcloud if you're stuck after an upgrade"
|
52
scripts/actions/disable_maintenance
Executable file
52
scripts/actions/disable_maintenance
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF ARGUMENTS ARE CORRECT
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# CHECK IF AN ACTION HAS TO BE DONE
|
||||
#=================================================
|
||||
|
||||
# Check the current status of the maintenance mode
|
||||
|
||||
if [ "$(grep "maintenance" "$final_path/config/config.php" | awk '{print $3}' | cut -d',' -f1)" != "true" ]
|
||||
then
|
||||
ynh_die --message="Nextcloud isn't currently under maintenance." --ret_code=0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC ACTION
|
||||
#=================================================
|
||||
# DISABLE THE MAINTENANCE MODE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Disabling maintenance mode..." --weight=3
|
||||
|
||||
(
|
||||
cd "$final_path" && exec_as "$app" \
|
||||
php$YNH_PHP_VERSION occ --no-interaction --no-ansi maintenance:mode --off
|
||||
)
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Execution completed" --last
|
Loading…
Add table
Reference in a new issue