From ca7ed3f184d92f616a657d23014b10a3eeac1b53 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 28 Jun 2022 22:06:37 +0200 Subject: [PATCH] Fix melange-de-versions https://forum.yunohost.org/t/melange-de-versions-de-moodle-detectees/19985 --- scripts/upgrade | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0a88f8e..2bfcf9e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -109,9 +109,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" --keep="$final_path/config.php" - #php${phpversion} $final_path/admin/cli/upgrade.php + 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"