diff --git a/scripts/upgrade b/scripts/upgrade index 6f892f9..16a09d9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,8 +80,28 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." + # Create a temporary directory + tmpdir="$(mktemp -d)" + # Backup the config file in the temp dir + cp -a "$final_path/config/config.ini.php" "$tmpdir/config.ini.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.ini.php" "$final_path/config/config.ini.php" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" + + pushd "$final_path" + chown -R $app: $final_path/tmp/* + ./console core:update + popd + fi #=================================================