From 7691d27aa39cd01ba342b8cb065e4454ec98d927 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 26 Dec 2020 19:18:26 +0100 Subject: [PATCH] Update upgrade --- scripts/upgrade | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8d7e7b6..748ec26 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,31 +62,11 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=5 - if [[ ! -f "$final_path/data" ]]; then - # config.ini.php is only created during the post-install process... - # it is therefore not present when the CI tests are carried out... - # This condition is only for CI test to go through the upgrade process - ynh_secure_remove --file="$final_path" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" - else - - tmpdir="$(mktemp -d)" - - # Backup the config file in the temp dir - cp -a "$final_path/data" "$tmpdir/data" - # 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/data" "$final_path/config/data" - - # Remove the tmp directory securely - ynh_secure_remove --file="$tmpdir" fi #================================================= @@ -113,6 +93,15 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config --package="$extra_php_dependencies" +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +cp -a ../conf/config-dist.php "$final_path/data/config.php" + +ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/data/config.php" + + #================================================= # SECURE FILES AND DIRECTORIES #=================================================