From 0cf7e06baa3309df5d112bb2cc2593b09cafa999 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Mon, 11 Sep 2023 16:57:47 +0200 Subject: [PATCH 1/3] Use console.php for entering/exiting maintenance mode. Also always exit maintenance, even if script fails. --- scripts/backup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/backup b/scripts/backup index 8dce025..597bead 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,9 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." -(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console maintenance 1) +(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console.php maintenance 1) + +trap "(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console.php maintenance 0)" EXIT #================================================= # BACKUP THE APP MAIN DIR @@ -61,8 +63,6 @@ ynh_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql -(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console maintenance 0) - #================================================= # END OF SCRIPT #================================================= From 3f4c68c80b5c831eb3fdd0b1b67ab768aaad626e Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Tue, 12 Sep 2023 13:41:40 +0200 Subject: [PATCH 2/3] Exit maintenance mode in restore --- scripts/restore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/restore b/scripts/restore index 648fa0a..29f7215 100644 --- a/scripts/restore +++ b/scripts/restore @@ -57,6 +57,13 @@ ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload +#============== +# FINALIZATION +#============== + +# exit maintenance mode since the app was backed up while in maintenance mode +(cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console.php maintenance 0) + #================================================= # END OF SCRIPT #================================================= From 9aaece6781176a026ac7749f152216678a4ce38f Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Tue, 12 Sep 2023 21:41:20 +0200 Subject: [PATCH 3/3] Use console.php for DB migrations as well. --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 7901ba9..534cdea 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -65,7 +65,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg # Run Composer pushd "$install_dir" ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet - ynh_exec_as "$app" php$phpversion bin/console dbstructure update + ynh_exec_as "$app" php$phpversion bin/console.php dbstructure update popd #=================================================