From 766aaa0bb69522a332f720d0e54d08dd7051aa3d Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Mon, 1 Nov 2021 16:16:53 +0100 Subject: [PATCH] simply read the version to pre-upgrade if necessary on upgrading --- scripts/upgrade | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d682370..a04d80c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,13 +25,13 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) # CHECK VERSION #================================================= -if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1; then - upgrade_type="0.9.8" -elif ynh_compare_current_package_version --comparison le --version 1.0.7~ynh2; then - upgrade_type="1.1.0" -else +#if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1; then +# upgrade_type="0.9.8" +#elif ynh_compare_current_package_version --comparison le --version 1.0.7~ynh2; then +# upgrade_type="1.1.0" +#else upgrade_type=$(ynh_check_app_version_changed) -fi +#fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -85,10 +85,11 @@ fi # UPGRADE TO 0.9.8 if necessary #================================================= -if [ "$upgrade_type" == "0.9.8" ] +if ynh_compare_current_package_version --comparison lt --version 0.9.8.1 then ynh_script_progression --message="Upgrading upgrade to 0.9.8" --weight=5 - # Download, check integrity, uncompress and patch the source from 0.9.8.src + + # Download, check integrity, uncompress and patch the source from 0.9.8.src ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" --source_id="0.9.8" # Set permissions on app files ynh_system_user_create --username=$app @@ -134,10 +135,11 @@ fi # UPGRADE TO 1.1.0 if necessary #================================================= -if [ "$upgrade_type" == "1.1.0" ] +if ynh_compare_current_package_version --comparison lt --version 1.1.0 then ynh_script_progression --message="Upgrading upgrade to 1.1.0" --weight=5 - # Download, check integrity, uncompress and patch the source from 0.9.8.src + + # Download, check integrity, uncompress and patch the source from 1.1.0.src ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" --source_id="1.1.0" # Set permissions on app files ynh_system_user_create --username=$app