From 81519393b20d5e8f1032c51c9172d90273349389 Mon Sep 17 00:00:00 2001 From: oleole39 Date: Mon, 23 Jan 2023 04:01:10 +0100 Subject: [PATCH] Fix restore script bug; Added notes to _common.sh --- scripts/_common.sh | 4 ++-- scripts/restore | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 3baec23..1c929d5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -109,7 +109,7 @@ ynh_psql_remove_all_user_dbs() { if [ -n "$dbs_to_drop" ]; then # Check that the list of database(s) is not empty local db_name - for db_name in $dbs_to_drop # Iterate through the list of database(s) to remove + for db_name in $dbs_to_drop # Iterate through the list of database(s) to remove. Note: this would fail in case databases names would contain space character or characters such as "*". IFS parsing method would then be required. do if ynh_psql_database_exists --database=$db_name; then # Check if the database exists ynh_psql_drop_db $db_name # Remove the database @@ -143,7 +143,7 @@ ynh_psql_dump_all_user_dbs() { if [ -n "$dbs_to_dump" ]; then # Check that the list of database(s) is not empty local db_name - for db_name in $dbs_to_dump # Iterate through the list of database(s) to dump + for db_name in $dbs_to_dump # Iterate through the list of database(s) to dump. Note: this would fail in case databases names would contain space character or characters such as "*". IFS parsing method would then be required. do if ynh_psql_database_exists --database=$db_name; then # Check if the database exists ynh_psql_dump_db $db_name > "$app-$db_name-dump.sql" # Dump the database to a filename format of app-db_name-dump.sql, or of db_name-dump.sql if app parameter was not supplied diff --git a/scripts/restore b/scripts/restore index 9513c37..5d0ac21 100755 --- a/scripts/restore +++ b/scripts/restore @@ -85,7 +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_restore_all_app_dbs_dumps --db_user=db_user --db_user_pwd=db_user_pwd +ynh_psql_restore_all_app_dbs_dumps --db_user=$db_user --db_user_pwd=db_user_pwd #================================================= # GENERIC FINALIZATION