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 #=================================================