From 0ef3db2452d24882b3791c4e5190e82942a977b9 Mon Sep 17 00:00:00 2001 From: oleole39 Date: Fri, 20 Jan 2023 03:36:08 +0100 Subject: [PATCH] Fixed change_url & upgrade scripts: db_name key in settings becomes useless and is replaced by a db_user key of the same value; I left declaration as such in change_url script even though I renammed it in other scripts which needed it as for retrocompatibility in case it would be used as a global variable by some of the scripts's function which I didn't inspect (maybe that declaration is even unused). --- scripts/change_url | 3 +-- scripts/upgrade | 12 +++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 21ab533..4e1792e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,8 +30,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Add settings here as needed by your application -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name +db_user=$(ynh_app_setting_get --app=$app --key=db_user) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6c46f5f..87796be 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,9 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -db_user=$db_name +db_user=$(ynh_app_setting_get --app=$app --key=db_user) phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) #================================================= @@ -49,10 +47,10 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name +# If db_user doesn't exist, create it +if [ -z "$db_user" ]; then + db_user=$(ynh_sanitize_dbid --db_name=$app) + ynh_app_setting_set --app=$app --key=db_user --value=$db_user fi # If final_path doesn't exist, create it