From 3874a1bbf45b95827b36529f21f0165c1a2c80f6 Mon Sep 17 00:00:00 2001 From: CodeShakingSheep <19874562+CodeShakingSheep@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:34:12 +0100 Subject: [PATCH] Fix upgrading (#80) * Auto-update README * Update local.yaml Remove duplicate security block * Update upgrade Doing a hard cache flush for major upgrade * Update upgrade Fix syntax * Update upgrade Use ynh_secure_remove * Update upgrade Remove local.yaml for major version upgrade * Update upgrade No loading from cache for major upgrade * Update upgrade Do full replace for setup sources when major upgrade * Update upgrade Fix full_replace arg * Update upgrade cleaning * Update upgrade Remove obsolete source_id --------- Co-authored-by: yunohost-bot --- README.md | 2 +- README_fr.md | 2 +- conf/local.yaml | 8 -------- scripts/upgrade | 18 ++++++++++++++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 388baa8..9feb219 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Those roles are directly managed using YunoHost permission system. User choosen * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index ce4d9bc..0b65d70 100644 --- a/README_fr.md +++ b/README_fr.md @@ -51,7 +51,7 @@ Those roles are directly managed using YunoHost permission system. User choosen * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs diff --git a/conf/local.yaml b/conf/local.yaml index 8bd091a..b4c04cb 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -1,11 +1,3 @@ -security: - providers: - chain_provider: - chain: - providers: [kimai_ldap] - firewalls: - secured_area: - kimai_ldap: ~ kimai: user: registration: __REGISTRATION__ diff --git a/scripts/upgrade b/scripts/upgrade index 004dd39..fca96d9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,7 +37,7 @@ upgrade_type=$(ynh_check_app_version_changed) if [ "$database" == "sqlite" ] then ynh_script_progression --message="Sqlite is not more supported by Kimai2..." - ynh_script_progression --message="Kimai2 will be upgrade to last available version : 1.13" + ynh_script_progression --message="Kimai2 will be upgraded to last available version : 1.13" if ynh_compare_current_package_version --comparison ge --version 1.17.1~ynh1 then ynh_script_progression --message="Kimai2 sqlite version is already to the last available version, no upgrade will be made" @@ -112,8 +112,18 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] 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="$final_path" --keep="var/invoices/ var/data/" #config/packages/local.yaml + if ynh_compare_current_package_version --comparison le --version 1.30.0~ynh1 + then + ynh_script_progression --message="Doing a hard cache flush for major Kimai 2 update from version 1.x to 2.x" + + # Download, check integrity, uncompress and patch the source from app.src + # Remove local.yaml as recommended for major version upgrade https://github.com/kimai/kimai/blob/main/UPGRADING.md + # As a full_replace (see https://www.kimai.org/documentation/updates.html) is performed keep .env file + ynh_setup_source --dest_dir="$final_path" --keep=".env var/invoices/ var/data/" --full_replace=1 + else + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" --keep="config/packages/local.yaml var/invoices/ var/data/" + fi fi chmod 750 "$final_path" @@ -154,7 +164,7 @@ ynh_add_nginx_config ynh_script_progression --message="Building $app..." --weight=1 ynh_install_composer --phpversion="$YNH_PHP_VERSION" --workdir="$final_path" --install_args="--optimize-autoloader --no-interaction" -ynh_composer_exec --phpversion="$YNH_PHP_VERSION" --workdir="$final_path" --commands="require laminas/laminas-ldap" +ynh_composer_exec --phpversion="$YNH_PHP_VERSION" --workdir="$final_path" --commands="require laminas/laminas-ldap --optimize-autoloader" chmod 750 "$final_path" chmod -R o-rwx "$final_path"