diff --git a/scripts/upgrade b/scripts/upgrade index 12ae2d3..43d94b9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,6 +54,13 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid "$app") @@ -78,13 +85,6 @@ if [ -z "$database" ]; then ynh_app_setting_set --app=$app --key=database --value=$database fi -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - #================================================= # CREATE DEDICATED USER #================================================= @@ -102,19 +102,7 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - mv "$final_path" "$final_path.old" - - ynh_setup_source --dest_dir="$final_path" - #ynh_secure_remove "$final_path"/tests - - # when running automatic tests, there is no config.inc.php - if [ -e "$final_path.old/galette/config/config.inc.php" ]; then - cp "$final_path.old/galette/config/config.inc.php" "$final_path/galette/config/config.inc.php" - cp -r "$final_path.old/galette/data" "$final_path/galette/data" - fi - - # delete temp directory - ynh_secure_remove --file="$final_path.old" + ynh_setup_source --dest_dir="$final_path" --keep="galette/config/config.inc.php galette/data/" fi chmod 750 "$final_path"