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

Merge pull request #94 from YunoHost-Apps/fucking_maintenance

Action to remove maintenance mode
This commit is contained in:
Maniack Crudelis 2020-04-25 12:03:12 +02:00 committed by GitHub
commit 5f821dccaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 1 deletions

View file

@ -10,7 +10,6 @@ description = "Change the public access of the app."
ask = "Is it a public app ?" ask = "Is it a public app ?"
default = true default = true
[reset_default_nginx] [reset_default_nginx]
name = "Reset the nginx config for this app." name = "Reset the nginx config for this app."
command = "/bin/bash scripts/actions/reset_default_system nginx" command = "/bin/bash scripts/actions/reset_default_system nginx"
@ -39,3 +38,13 @@ command = "/bin/bash scripts/actions/reset_default_app"
# accepted_return_codes = [0, 1, 2, 3] # optional # accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0] accepted_return_codes = [0]
description = "Reset the app to its default configuration to try to fix potential issues.<br>This action won't remove any data added to the app.<br>However, if you have modified any configuration, it will be overwritten." description = "Reset the app to its default configuration to try to fix potential issues.<br>This action won't remove any data added to the app.<br>However, if you have modified any configuration, it will be overwritten."
[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