Browse Source

Merge pull request #94 from YunoHost-Apps/fucking_maintenance

Action to remove maintenance mode
pull/85/head
Maniack Crudelis 6 years ago
committed by GitHub
parent
commit
5f821dccaa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      actions.toml
  2. 56
      scripts/actions/disable_maintenance

11
actions.toml

@ -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"

56
scripts/actions/disable_maintenance

@ -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
Loading…
Cancel
Save