1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/moodle_ynh.git synced 2024-09-03 19:46:23 +02:00
This commit is contained in:
ericgaspar 2021-08-18 15:09:32 +02:00
parent 710e160955
commit 605710c787
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 42 additions and 4 deletions

29
conf/config-domain.php Normal file
View file

@ -0,0 +1,29 @@
<?php
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->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!

View file

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