diff --git a/conf/config.ini.php b/conf/config.ini.php new file mode 100644 index 0000000..0d3b9c6 --- /dev/null +++ b/conf/config.ini.php @@ -0,0 +1,9 @@ +; DO NOT REMOVE THIS LINE +; 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_NAME__" +password = "__DB_PASSWORD__" +dbname = "__DB_NAME__" +tables_prefix = "matomo_" + diff --git a/scripts/upgrade b/scripts/upgrade index 18104cf..ae0fa4d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -81,26 +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/config.ini.php" "$tmpdir/config.ini.php" + if [[ ! -f "$final_path/config/config.ini.php" ]]; then + ynh_setup_source --dest_dir="$final_path" + else + # Create a temporary directory + tmpdir="$(mktemp -d)" - # Remove the app directory securely - ynh_secure_remove --file="$final_path" + # Backup the config file in the temp dir + cp -a "$final_path/config/config.ini.php" "$tmpdir/config.ini.php" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$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" + # 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" - - pushd "$final_path" - ynh_exec_as $app ./console core:update - popd + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" + fi fi #================================================= @@ -136,6 +134,11 @@ ynh_script_progression --message="Installating composer and dependencies..." ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" +if [[ -f "$final_path/config/config.ini.php" ]]; then + cd "$final_path" + ynh_exec_as $app ./console core:update +fi + #================================================= # SETUP A CRON #=================================================