From a523048d5c157cfdd0454d06d0f5bf4fe56f3af7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Jun 2021 17:45:28 +0200 Subject: [PATCH] Revert "Add ynh_add_config" This reverts commit 054dc5ec5303a4acb8cdf7ab0bdd58ac4729092a. --- scripts/install | 11 ++++++++--- scripts/upgrade | 12 +++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 939842b..d32dc12 100644 --- a/scripts/install +++ b/scripts/install @@ -126,9 +126,14 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name #================================================= ynh_script_progression --message="Configuring Roundcube..." -file="__FILE__" -deskey="$(ynh_string_random --length=24)" -ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config/config.inc.php" +rc_conf="$final_path/config/config.inc.php" + +cp ../conf/config.inc.php "$rc_conf" + +ynh_replace_string --match_string="__DESKEY__" --replace_string="$(ynh_string_random --length=24)" --target_file="$rc_conf" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$rc_conf" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$rc_conf" +ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$rc_conf" #================================================= # INSTALL ADDITIONAL PLUGINS diff --git a/scripts/upgrade b/scripts/upgrade index 939bf61..7362176 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -156,9 +156,15 @@ then rc_conf="$final_path/config/config.inc.php" - file="__FILE__" - deskey="$(ynh_string_random --length=24)" - ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config/config.inc.php" + # Verify the checksum and backup the file if it's different + ynh_backup_if_checksum_is_different "$rc_conf" + + cp ../conf/config.inc.php "$rc_conf" + + ynh_replace_string --match_string="__DESKEY__" --replace_string="$(ynh_string_random --length=24)" --target_file="$rc_conf" + ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$rc_conf" + ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$rc_conf" + ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$rc_conf" #================================================= # UPDATE DEPENDENCIES WITH COMPOSER