From 79265a89c411d9059b2565dceeed40c40ae95d8f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 10 Dec 2020 12:30:54 +0100 Subject: [PATCH] Update upgrade --- scripts/upgrade | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 #=================================================