From 5faee4258fa87adacc634e69d0629a3a32c3279d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 6 Apr 2022 13:22:11 +0200 Subject: [PATCH] Cleaning up --- conf/.env | 4 ++-- doc/DESCRIPTION.md | 0 scripts/_common.sh | 2 +- scripts/upgrade | 42 ++++-------------------------------------- 4 files changed, 7 insertions(+), 41 deletions(-) create mode 100644 doc/DESCRIPTION.md diff --git a/conf/.env b/conf/.env index 5cd1104..5161efb 100644 --- a/conf/.env +++ b/conf/.env @@ -27,7 +27,7 @@ DEFAULT_LOCALE=equal # Change this value to your preferred time zone. # Example: Europe/Amsterdam # For a list of supported time zones, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones -TZ=Europe/Amsterdam +TZ=__TIMEZONE__ # TRUSTED_PROXIES is a useful variable when using Docker and/or a reverse proxy. # Set it to ** and reverse proxies work just fine. @@ -62,7 +62,7 @@ DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=__DB_NAME__ -DB_USERNAME=__DB_NAME__ +DB_USERNAME=__DB_USER__ DB_PASSWORD=__DB_PWD__ # MySQL supports SSL. You can configure it here. diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..e69de29 diff --git a/scripts/_common.sh b/scripts/_common.sh index 9ebd8d2..6275b5f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,7 +9,7 @@ YNH_PHP_VERSION="8.0" # Composer version -YNH_COMPOSER_VERSION="2.0.13" +YNH_COMPOSER_VERSION="2.3.3" pkg_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-ldap" diff --git a/scripts/upgrade b/scripts/upgrade index 34d0cb5..ad98869 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) random_key=$(ynh_app_setting_get --app=$app --key=random_key) email=$(ynh_user_get_info --username=$admin --key=mail) phpversion=$YNH_PHP_VERSION +timezone="$(cat /etc/timezone)" #================================================= # CHECK VERSION @@ -85,50 +86,16 @@ ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" -#================================================= -# STANDARD UPGRADE STEPS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then - if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; - then - pushd "$final_path" - ynh_setup_source --dest_dir=$final_path - ynh_secure_remove --file="$final_path/bootstrap/cache/*" - ynh_secure_remove --file="$final_path/vendor/" - popd + ynh_script_progression --message="Upgrading source files..." - else - ynh_script_progression --message="Upgrading source files..." - # Create a temporary directory - tmpdir="$(mktemp -d)" - - # Backup the config file in the temp dir - mkdir -p "$tmpdir/storage/upload" - mkdir -p "$tmpdir/storage/export" - mkdir -p "$final_path/storage/upload/" - mkdir -p "$final_path/storage/export/" - cp -aT "$final_path/storage/upload" "$tmpdir/storage/upload/$" - cp -a "$final_path/.env" "$tmpdir/.env" - cp -aT "$final_path/storage/export" "$tmpdir/storage/export/" - ynh_secure_remove --file="$final_path" - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir=$final_path - ynh_secure_remove bootstrap/cache/* - - # Restore the config file and data - mkdir -p "$final_path/storage/upload/" - mkdir -p "$final_path/storage/export/" - cp -aT "$tmpdir/storage/upload" "$final_path/storage/upload" - cp -aT "$tmpdir/storage/export" "$final_path/storage/export" - cp -a "$tmpdir/.env" "$final_path/.env" - # Remove temporary directory - ynh_secure_remove --file="$tmpdir" - fi + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env $final_path/storage/upload $final_path/storage/export" fi chmod 750 "$final_path" @@ -159,7 +126,6 @@ ynh_add_fpm_config --phpversion=$phpversion #================================================= ynh_script_progression --message="Updating PHP dependencies..." -chown -R $app $final_path ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" #=================================================