1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wordpress_ynh.git synced 2024-09-03 20:36:10 +02:00

Action to remove maintenance mode

This commit is contained in:
Maniack Crudelis 2020-04-21 12:45:43 +02:00
parent 0787a3c620
commit 373685d573
2 changed files with 65 additions and 0 deletions

View file

@ -9,3 +9,12 @@ description = "Change the public access of the app."
type = "boolean"
ask = "Is it a public app ?"
default = true
[disable_maintenance]
name = "Disable the maintenance mode of Wordpress"
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 Wordpress if you're stuck after an upgrade"

View file

@ -0,0 +1,56 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# 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 [ ! -e "$final_path/.maintenance" ]
then
ynh_die --message="Wordpress isn't currently under maintenance." --ret_code=0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# DISABLE THE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Disabling maintenance mode..."
ynh_secure_remove --file="$final_path/.maintenance"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last