This commit is contained in:
ericgaspar 2021-08-13 19:58:09 +02:00
parent e072918fb5
commit 07368aafde
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 7 additions and 17 deletions

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
@ -33,7 +33,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -99,20 +99,12 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Configuring $app..." --weight=1 ynh_script_progression --message="Configuring $app..." --weight=1
domain="$new_domain" domain=$new_domain
path_url="$new_path"
ynh_backup_if_checksum_is_different --file="$final_path/config.php" ynh_add_config --template="../conf/config.php" --destination="$final_path/config.php"
cp ../conf/config.php "$final_path/config.php" chmod 400 "$final_path/config.php"
chown $app:$app "$final_path/config.php"
# Change domain name in config.php
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DOMAIN_PATH__" --replace_string="https://$domain$path_url" --target_file="$final_path/config.php"
# Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/config.php"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -105,12 +105,10 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
domain_path=https://$domain${path_url:1}
ynh_add_config --template="../conf/config.php" --destination="$final_path/config.php" ynh_add_config --template="../conf/config.php" --destination="$final_path/config.php"
chmod 400 "$final_path/config.php" chmod 400 "$final_path/config.php"
chown $app:$app "$final_path/config.php" chown $app "$final_path/config.php"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT