From 605710c787dfbe3879e7c7f2a6d871a090f37aef Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 18 Aug 2021 15:09:32 +0200 Subject: [PATCH] Fix --- conf/config-domain.php | 29 +++++++++++++++++++++++ conf/{config-dist.php => config-path.php} | 0 scripts/change_url | 17 +++++++++---- 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 conf/config-domain.php rename conf/{config-dist.php => config-path.php} (100%) diff --git a/conf/config-domain.php b/conf/config-domain.php new file mode 100644 index 0000000..63e132d --- /dev/null +++ b/conf/config-domain.php @@ -0,0 +1,29 @@ +dbtype = 'pgsql'; +$CFG->dblibrary = 'native'; +$CFG->dbhost = 'localhost'; +$CFG->dbname = '__DB_NAME__'; +$CFG->dbuser = '__DB_NAME__'; +$CFG->dbpass = '__DB_PWD__'; +$CFG->prefix = 'mdl_'; +$CFG->dboptions = array( + 'dbpersist' => 0, + 'dbsocket' => '', + 'dbport' => '', +); + +$CFG->wwwroot = 'https://__DOMAIN__'; +$CFG->dataroot = '__DATA_PATH__'; +$CFG->admin = 'admin'; + +$CFG->directorypermissions = 02777; + +require_once(__DIR__ . '/lib/setup.php'); // Do not edit + +// There is no php closing tag in this file, +// it is intentional because it prevents trailing whitespace problems! \ No newline at end of file diff --git a/conf/config-dist.php b/conf/config-path.php similarity index 100% rename from conf/config-dist.php rename to conf/config-path.php diff --git a/scripts/change_url b/scripts/change_url index a0db7bd..28454fe 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -27,6 +27,9 @@ app=$YNH_APP_INSTANCE_NAME ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP @@ -95,13 +98,19 @@ fi #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -#domain=${new_domain%/} -#path="/${new_path%/}" +domain=${new_domain%/} +path="/${new_path%/}" + +# if [ "$new_path" == "/" ]; then +# ynh_replace_string --match_string="\$CFG->wwwroot = .*" --replace_string="\$CFG->wwwroot = \'https:\/\/${new_domain%\/}\';" --target_file="$final_path/config.php" +# else +# ynh_replace_string --match_string="\$CFG->wwwroot = .*" --replace_string="\$CFG->wwwroot = \'https:\/\/${new_domain}${new_path%\/}\';" --target_file="$final_path/config.php" +# fi if [ "$new_path" == "/" ]; then - ynh_replace_string --match_string="\$CFG->wwwroot = .*" --replace_string="\$CFG->wwwroot = \'https:\/\/${new_domain%\/}\';" --target_file="$final_path/config.php" + ynh_add_config --template="../conf/config-domain.php" --destination="$final_path/config.php" else - ynh_replace_string --match_string="\$CFG->wwwroot = .*" --replace_string="\$CFG->wwwroot = \'https:\/\/${new_domain}${new_path%\/}\';" --target_file="$final_path/config.php" + ynh_add_config --template="../conf/config-path.php" --destination="$final_path/config.php" fi #=================================================