1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/noalyss_ynh.git synced 2024-09-03 19:46:20 +02:00

Fixed restore script: enable required restoration of multiple databases (all grouped under a dedicated PSQL user name corresponding to the app name); db_name key in settings becomes useless and is replaced by a db_user key of the same value; Changed path to _common.sh which looked strange

This commit is contained in:
oleole39 2023-01-20 03:28:41 +01:00
parent d6844d452e
commit 3e385afdd0

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
@ -26,9 +26,8 @@ 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)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_user_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -86,9 +85,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..."
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_psql_restore_all_app_dbs_dumps --db_user=db_user --db_user_pwd=db_user_pwd
#=================================================
# GENERIC FINALIZATION