From daad1682c89ff26e07e8b8094e07944da325e2c9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 13 Feb 2019 19:21:57 +0100 Subject: [PATCH] Trying to manage change_url --- check_process | 2 +- scripts/change_url | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index dac7494..f8eeef1 100644 --- a/check_process +++ b/check_process @@ -20,7 +20,7 @@ multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels Level 1=auto Level 2=auto diff --git a/scripts/change_url b/scripts/change_url index 13ddd0b..e19b82f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -95,7 +95,21 @@ fi application_file="$final_path/app/data/_data_/_default_/configs/application.ini" ynh_replace_string "default_domain = .^" "default_domain = \"$new_domain\"" "$application_file" -ynh_replace_string "$old_domain$old_path" "$new_domain$new_path" "$final_path/index.php" +if [ $old_path = "/" ] && [ $new_path = "/" ] +then + ynh_replace_string "$old_domain" "$new_domain" "$final_path/index.php" +elif [ $old_path != "/" ] && [ $new_path != "/" ] +then + ynh_replace_string "$old_domain$old_path" "$new_domain$new_path" "$final_path/index.php" +elif [ $old_path != "/" ] && [ $new_path = "/" ] +then + ynh_replace_string "$old_domain$old_path" "$new_domain" "$final_path/index.php" +elif [ $old_path = "/" ] && [ $new_path != "/" ] +then + ynh_replace_string "$old_domain" "$new_domain$new_path" "$final_path/index.php" +else + ynh_die "Error changing the URL" +fi #================================================= # GENERIC FINALISATION