From 1808971fa64e68a2bcf2b439af3635b91c32c29c Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Sun, 29 Oct 2023 21:52:33 +0100 Subject: [PATCH] Fully replace sources during upgrade. --- scripts/upgrade | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5c2cfa1..765d899 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,6 +38,17 @@ if [ -z "${fpm_usage:-}" ]; then ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi +#================================================= +# MOVE DATA TO __DATA_DIR__ +#================================================= + +if [ $(ynh_compare_current_package_version --comparison le --version "1.1.2~ynh2") ]; then + ynh_script_progression --message="Moving data..." --weight=3 + mv $install_dir/public/media $data_dir + chmod -R 644 $data_dir + chgrp -R www-data $data_dir +endif + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -47,7 +58,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep=".env public/media" + ynh_setup_source --dest_dir="$install_dir" --full_replace=1 fi chmod -R o-rwx "$install_dir" @@ -85,17 +96,10 @@ chown $app:www-data "$install_dir/.env" ynh_script_progression --message="Configuring $app database..." --weight=1 pushd $install_dir - ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark castopod:database-update ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark cache:clear + ynh_exec_warn_less ynh_exec_as $app php${phpversion} spark castopod:database-update popd -if [ $(ynh_compare_current_package_version --comparison le --version "1.1.2~ynh2") ]; then - ynh_script_progression --message="Moving data..." --weight=3 - mv $install_dir/public/media $data_dir - chmod -R 644 $data_dir - chgrp -R www-data $data_dir -endif - #================================================= # END OF SCRIPT #=================================================