From 33014beb5e56689b17da8911368a586fc21d6078 Mon Sep 17 00:00:00 2001 From: Kayou Date: Thu, 14 Mar 2019 00:24:55 +0100 Subject: [PATCH] Handle migration fail, and restore spip2 --- scripts/upgrade | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 24a43e1..e91b2d4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,6 +79,11 @@ ynh_print_info "Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + if [ $migration_process -eq 1 ]; then + yunohost app remove $app + # Reload some values changed by the migration process + app=$YNH_APP_INSTANCE_NAME + fi # restore it if the upgrade fails ynh_restore_upgradebackup } @@ -90,12 +95,11 @@ ynh_abort_if_errors #================================================= ynh_handle_app_migration "spip2" "spip2_migration" -if [ $migration_process -eq 1 ] -then - # If a migration has been perform - # Reload some values changed by the migration process - final_path=$(ynh_app_setting_get $app final_path) - db_name=$(ynh_app_setting_get $app db_name) +if [ $migration_process -eq 1 ]; then + # If a migration has been perform + # Reload some values changed by the migration process + final_path=$(ynh_app_setting_get $app final_path) + db_name=$(ynh_app_setting_get $app db_name) fi #=================================================