1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00
nextcloud_ynh/scripts/actions/disable_maintenance
2021-07-09 19:04:15 +02:00

52 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
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 --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --off
)
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last