From 33c2c7db323a6771b6df2f0fc60112d633d6bfff Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 17 Aug 2021 07:56:49 +0200 Subject: [PATCH] Update upgrade --- scripts/upgrade | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 3192503..769b081 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,6 +43,20 @@ defaulteventduration=$(ynh_app_setting_get --app=$app --key=defaulteventduration upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backup the app before upgrading" + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -102,20 +116,6 @@ if [ -z "$overwrite_phpfpm" ]; then ynh_app_setting_set $app overwrite_phpfpm $overwrite_phpfpm fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backup the app before upgrading" --weight=9 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # Migrate legacy permissions to new system #================================================= @@ -138,7 +138,7 @@ fi #================================================= # ACTIVATE MAINTENANCE MODE #================================================= -ynh_script_progression --message="Activate maintenance mode" +ynh_script_progression --message="Activate maintenance mode" --weight=1 ynh_maintenance_mode_ON @@ -147,7 +147,7 @@ ynh_maintenance_mode_ON #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrade dependencies" +ynh_script_progression --message="Upgrade dependencies" --weight=5 ynh_install_app_dependencies $pkg_dependencies @@ -171,7 +171,7 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Create a dedicated user" +ynh_script_progression --message="Create a dedicated user" --weight=2 # Create a dedicated user (if not existing) ynh_system_user_create $app