From 591cbf5cc4e1ad2f01a1e712836e98939ab85a35 Mon Sep 17 00:00:00 2001 From: OverSu Date: Mon, 7 Sep 2026 15:17:54 +0200 Subject: [PATCH] =?UTF-8?q?Prot=C3=A9ger=20les=20donn=C3=A9es=20persistant?= =?UTF-8?q?es=20=C3=A0=20la=20mise=20=C3=A0=20jour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/restore | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/scripts/restore b/scripts/restore index 6aa5d13..045e798 100755 --- a/scripts/restore +++ b/scripts/restore @@ -4,31 +4,41 @@ # IMPORT GENERIC HELPERS #================================================= +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= -# RESTORE THE APP MAIN DIR +# RESTORE FILES AND DATA #================================================= -ynh_script_progression "Restoring the app main directory..." + +ynh_script_progression "Restoring application files..." ynh_restore "$install_dir" +ynh_restore "$data_dir" #================================================= # RESTORE SYSTEM CONFIGURATION #================================================= + ynh_script_progression "Restoring system configurations related to $app..." +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" +migrate_legacy_data -#================================================= -# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE -#================================================= -ynh_script_progression "Reloading NGINX web server and $app's service..." +for migrated_path in "$install_dir/data" "$install_dir/storage" "$install_dir/public/media"; do + if [[ -d "$migrated_path" && ! -L "$migrated_path" ]]; then + ynh_safe_rm "$migrated_path" + fi +done + +prepare_persistent_paths +install_yunohost_logo +ynh_exec_as_app php "$install_dir/scripts/migrate.php" +repair_and_verify_permissions ynh_systemctl --service="php$php_version-fpm" --action=reload - ynh_systemctl --service=nginx --action=reload #=================================================