diff --git a/scripts/upgrade b/scripts/upgrade index 46eaacc..a47efdc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -78,11 +78,23 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=6 +# Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/config.php" "$tmpdir/config.php" + # Remove the app directory securely ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" + + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/config.php" "$final_path/config.php" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi chmod 750 "$final_path" @@ -116,14 +128,14 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # UPGRADING THE APPLICATION #================================================= -ynh_script_progression --message="Upgrading the application..." --weight=1 +# ynh_script_progression --message="Upgrading the application..." --weight=1 -ynh_backup_if_checksum_is_different --file="$final_path/config.php" +# ynh_backup_if_checksum_is_different --file="$final_path/config.php" -ynh_exec_as $app php${phpversion} "$final_path/admin/cli/upgrade.php" --non-interactive +# ynh_exec_as $app php${phpversion} "$final_path/admin/cli/upgrade.php" --non-interactive -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/config.php" +# # Recalculate and store the checksum of the file for the next upgrade. +# ynh_store_file_checksum --file="$final_path/config.php" #================================================= # ACTIVATE LDAP SUPPORT