From f8e834adb2604ae4e31fbd6e8ff57511b9ec5419 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Sun, 11 Feb 2024 22:30:36 +0100 Subject: [PATCH] fix url on upgrade --- scripts/upgrade | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 534cdea..64dbb93 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,6 +58,16 @@ chmod 644 "/etc/cron.d/$app" # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +# fix the url if necessary (there should be no trailing slash) +if ! grep -q -e "'url' => 'https://$domain'," "$install_dir/config/local.config.php"; then + ynh_replace_string --match_string="'url' => 'https://.*'," --replace_string="'url' => 'https://$domain'," --target_file="$install_dir/config/local.config.php" +fi + #================================================= # STORE THE CONFIG FILE CHECKSUM #=================================================