From e5ec9b4a423b4cc770f33cd23a7d2f1fabffc2c4 Mon Sep 17 00:00:00 2001 From: maniack Date: Mon, 9 Dec 2019 18:12:34 +0100 Subject: [PATCH 1/2] Update to last standard --- check_process | 2 -- scripts/change_url | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index a039cd8..ae40e3b 100644 --- a/check_process +++ b/check_process @@ -17,7 +17,6 @@ upgrade=1 from_commit=cbb74263e33deb0ec36f99886a2f773e36d40fd9 backup_restore=1 multi_instance=1 - incorrect_path=1 port_already_use=0 change_url=1 ;; Test avec multisite @@ -37,7 +36,6 @@ upgrade=1 backup_restore=1 multi_instance=1 - incorrect_path=0 port_already_use=0 change_url=0 ;;; Levels diff --git a/scripts/change_url b/scripts/change_url index 5c7502d..3ba81c0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -35,6 +35,23 @@ then ynh_die --message="https://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite" fi +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=5 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ACTIVATE MAINTENANCE MODE #================================================= From 3faae6b27694ed363d4c3605c4718963eb3d994f Mon Sep 17 00:00:00 2001 From: maniack Date: Sat, 28 Dec 2019 12:08:19 +0100 Subject: [PATCH 2/2] Replace wp-fail2ban by wp-fail2ban-redux --- scripts/install | 4 ++-- scripts/upgrade | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index d435272..3388fe5 100644 --- a/scripts/install +++ b/scripts/install @@ -167,7 +167,7 @@ wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path" $wpcli_alias plugin install simple-ldap-login $wpcli_alias plugin install http-authentication $wpcli_alias plugin install companion-auto-update -$wpcli_alias plugin install wp-fail2ban +$wpcli_alias plugin install wp-fail2ban-redux #================================================= # SET LANGUAGE @@ -210,7 +210,7 @@ ynh_script_progression --message="Activating plugins..." --weight=4 $wpcli_alias plugin activate simple-ldap-login $plugin_network # Do not activate http-authentication, this plugin is sometimes unstable $wpcli_alias plugin activate companion-auto-update $plugin_network -$wpcli_alias plugin activate wp-fail2ban $plugin_network +$wpcli_alias plugin activate wp-fail2ban-redux $plugin_network #================================================= # STORE THE CONFIG FILE CHECKSUM diff --git a/scripts/upgrade b/scripts/upgrade index 7fca596..19f8e1c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,6 +83,12 @@ if grep add_filter.*auto_update $final_path/wp-config.php; then sed --in-place '/add_filter.*auto_update/d' $final_path/wp-config.php fi +# Replace wp-fail2ban by wp-fail2ban-redux +wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar +wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path" +$wpcli_alias plugin is-installed wp-fail2ban && $wpcli_alias plugin deactivate wp-fail2ban && $wpcli_alias plugin uninstall wp-fail2ban +$wpcli_alias plugin is-installed wp-fail2ban-redux || $wpcli_alias plugin install wp-fail2ban-redux + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -179,8 +185,8 @@ ynh_app_setting_set --app=$app --key=multisite --value=$multisite #================================================= ynh_script_progression --message="Updating plugins" --weight=11 -wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar -wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path" +# wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar +# wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path" update_plugin () { ( $wpcli_alias plugin is-installed $1 && $wpcli_alias plugin update $1 ) || $wpcli_alias plugin install $1 } @@ -188,8 +194,8 @@ update_plugin simple-ldap-login $wpcli_alias plugin activate simple-ldap-login $plugin_network update_plugin companion-auto-update $wpcli_alias plugin activate companion-auto-update $plugin_network -update_plugin wp-fail2ban -$wpcli_alias plugin activate wp-fail2ban $plugin_network +update_plugin wp-fail2ban-redux +$wpcli_alias plugin activate wp-fail2ban-redux $plugin_network # Disable broken plugin http-authentication $wpcli_alias plugin is-installed http-authentication && $wpcli_alias plugin deactivate http-authentication $plugin_network