From 2931b0bf593c8df89c8e1e31eb54680bbb3443d5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 11:39:52 +0100 Subject: [PATCH 01/10] Fix --- conf/config.ini.php | 5 +++-- scripts/install | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/conf/config.ini.php b/conf/config.ini.php index beda577..0d3b9c6 100644 --- a/conf/config.ini.php +++ b/conf/config.ini.php @@ -2,7 +2,8 @@ ; file automatically generated or modified by Matomo; you can manually override the default values in global.ini.php by redefining them in this file. [database] host = "127.0.0.1" -username = "__DB__" +username = "__DB_NAME__" password = "__DB_PASSWORD__" -dbname = "__DB__" +dbname = "__DB_NAME__" tables_prefix = "matomo_" + diff --git a/scripts/install b/scripts/install index 8115366..7856e1e 100755 --- a/scripts/install +++ b/scripts/install @@ -113,6 +113,11 @@ ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion cp -f ../conf/cron /etc/cron.d/$app +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/config.ini.php" +ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="../conf/config.ini.php" + +cp -f ../conf/config.ini.php $final_path/config/config.ini.php + #================================================= # GENERIC FINALIZATION #================================================= From 04df2b22dcd03a384d4f44b2839c081e4decd531 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 11:56:48 +0100 Subject: [PATCH 02/10] Fix --- scripts/install | 5 ----- scripts/upgrade | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index 7856e1e..8115366 100755 --- a/scripts/install +++ b/scripts/install @@ -113,11 +113,6 @@ ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion cp -f ../conf/cron /etc/cron.d/$app -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/config.ini.php" -ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="../conf/config.ini.php" - -cp -f ../conf/config.ini.php $final_path/config/config.ini.php - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1c2b90a..9f0c0e3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,16 +83,16 @@ then # Create a temporary directory tmpdir="$(mktemp -d)" # Backup the config file in the temp dir - cp -a "$final_path/config/config.ini.php" "$tmpdir/config.ini.php" + cp -a "$final_path/config" "$tmpdir" # Remove the app directory securely - ynh_secure_remove --file=$final_path + ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" #Copy the admin saved settings from tmp directory to final path - cp -a "$tmpdir/config.ini.php" "$final_path/config/config.ini.php" + cp -a "$tmpdir" "$final_path/config" # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" From c68d1ef6fb3ad9b2f6a952064c53defcea9b0aab Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 12:20:57 +0100 Subject: [PATCH 03/10] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 9f0c0e3..629fbc8 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -97,8 +97,8 @@ then # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" - pushd "$final_path/console" - ynh_exec_as $app core:update + pushd "$final_path" + ynh_exec_as $app ./console core:update popd fi From 5a214dd784c04253ee4876a838955ba8e0f03dc2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 12:36:49 +0100 Subject: [PATCH 04/10] Update upgrade --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 629fbc8..54d839d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -91,6 +91,8 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" + ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" + #Copy the admin saved settings from tmp directory to final path cp -a "$tmpdir" "$final_path/config" From ff90496a9fec36d52773d7c221ede5768311f5c4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 12:45:42 +0100 Subject: [PATCH 05/10] Update upgrade --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 54d839d..f4630eb 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -93,7 +94,7 @@ then ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" - #Copy the admin saved settings from tmp directory to final path + # Copy the admin saved settings from tmp directory to final path cp -a "$tmpdir" "$final_path/config" # Remove the tmp directory securely From af9210cd2f16bc74eeabdc13295d6e314b39f88d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 12:59:10 +0100 Subject: [PATCH 06/10] Update upgrade --- scripts/upgrade | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index f4630eb..a857f7b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,14 +86,9 @@ then # Backup the config file in the temp dir cp -a "$final_path/config" "$tmpdir" - # Remove the app directory securely - 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_install_composer --phpversion="$phpversion" --workdir="$final_path" - # Copy the admin saved settings from tmp directory to final path cp -a "$tmpdir" "$final_path/config" From 6cc63520f9cb1f4dd17262c81395bfc98a386fa2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 13:30:51 +0100 Subject: [PATCH 07/10] Update upgrade --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a857f7b..e108641 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,9 +95,6 @@ then # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" - pushd "$final_path" - ynh_exec_as $app ./console core:update - popd fi #================================================= @@ -134,6 +131,8 @@ ynh_script_progression --message="Installating composer and dependencies..." ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" +cd "$final_path" && ynh_exec_as $app ./console core:update + #================================================= # SETUP A CRON #================================================= @@ -144,6 +143,7 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_fil ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/cron" ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="../conf/cron" ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="../conf/cron" + cp -f ../conf/cron /etc/cron.d/$app #================================================= From b8f750779f4b62312859890d093ab41c85a9884c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 13:57:04 +0100 Subject: [PATCH 08/10] Fix --- scripts/upgrade | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e108641..0456b5e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -81,20 +81,24 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." - # Create a temporary directory - tmpdir="$(mktemp -d)" - # Backup the config file in the temp dir - cp -a "$final_path/config" "$tmpdir" + if [ -z "$final_path/config/config.ini.php" ]; then + ynh_setup_source --dest_dir="$final_path" + else + # Create a temporary directory + tmpdir="$(mktemp -d)" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + # Backup the config file in the temp dir + cp -a "$final_path/config/config.ini.php" "$tmpdir/config.ini.php" - # Copy the admin saved settings from tmp directory to final path - cp -a "$tmpdir" "$final_path/config" + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" - # Remove the tmp directory securely - ynh_secure_remove --file="$tmpdir" + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/config.ini.php" "$final_path/config/config.ini.php" + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" + fi fi #================================================= @@ -131,7 +135,10 @@ ynh_script_progression --message="Installating composer and dependencies..." ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" -cd "$final_path" && ynh_exec_as $app ./console core:update +if [ -z "$final_path/config/config.ini.php" ]; then + cd "$final_path" + ynh_exec_as $app ./console core:update +fi #================================================= # SETUP A CRON From 023c0893541c5a9caaca250fc3c2d02d291ec26d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 14:03:35 +0100 Subject: [PATCH 09/10] Update upgrade --- scripts/upgrade | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0456b5e..52bbebe 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -81,7 +81,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." - if [ -z "$final_path/config/config.ini.php" ]; then + if [[ ! -f "$final_path/config/config.ini.php" ]]; then ynh_setup_source --dest_dir="$final_path" else # Create a temporary directory @@ -124,7 +124,6 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=medium --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE @@ -135,7 +134,7 @@ ynh_script_progression --message="Installating composer and dependencies..." ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" -if [ -z "$final_path/config/config.ini.php" ]; then +if [[ -f "$final_path/config/config.ini.php" ]]; then cd "$final_path" ynh_exec_as $app ./console core:update fi From 4c97f7956eb8c8a39fd6de32a95254163b6f40fb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 14:15:02 +0100 Subject: [PATCH 10/10] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 52bbebe..e181be9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -144,7 +144,7 @@ fi #================================================= ynh_script_progression --message="Setuping a cron..." -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../conf/cron" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../conf/cron" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/cron" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/cron" ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="../conf/cron"