diff --git a/conf/cron b/conf/cron index 02900b9..d3bd95c 100644 --- a/conf/cron +++ b/conf/cron @@ -1,2 +1,2 @@ -MAILTO="admin" +MAILTO="__EMAIL__" 5 * * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/console core:archive --url=https://__DOMAIN____PATH__ > /dev/null diff --git a/conf/icons.src b/conf/icons.src deleted file mode 100644 index 6ffad8e..0000000 --- a/conf/icons.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/matomo-org/matomo-icons/archive/e96ef33bf490794829831cbb795fd4ea67259699.tar.gz -SOURCE_SUM=9a6457d8f138216f911621db7a5af5fbce7214e62d6f184730f216986e498b53 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/manifest.json b/manifest.json index cdecd7d..8e01b22 100644 --- a/manifest.json +++ b/manifest.json @@ -43,6 +43,11 @@ "example": "/matomo", "default": "/matomo" }, + { + "name": "admin", + "type": "user", + "example": "johndoe" + }, { "name": "is_public", "type": "boolean", diff --git a/scripts/_common.sh b/scripts/_common.sh index 00f941c..e932edf 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,9 +8,6 @@ YNH_PHP_VERSION="7.3" extra_php_dependencies="php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mbstring" -# Composer version -YNH_COMPOSER_VERSION="2.0.13" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index a040cdd..bcb0142 100755 --- a/scripts/install +++ b/scripts/install @@ -22,6 +22,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH +admin=$YNH_APP_ARG_ADMIN +email=$(ynh_user_get_info --username=$admin --key=mail) is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -94,10 +96,6 @@ ynh_script_progression --message="Configuring PHP-FPM..." ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -#================================================= -# SPECIFIC SETUP -#================================================= - #================================================= # SETUP A CRON #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5d36b94..75bfb3a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,6 +21,8 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) 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) +admin=$YNH_APP_ARG_ADMIN +email=$(ynh_user_get_info --username=$admin --key=mail) #================================================= # CHECK VERSION @@ -46,6 +48,11 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# If admin doesn't exist +if [ -z "$admin" ]; then + email=root@$domain +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -91,8 +98,19 @@ then # This condition is only for CI test to go through the upgrade process ynh_setup_source --dest_dir="$final_path" else + # Create a temporary directory + tmpdir="$(mktemp -d)" + + cp -a "$final_path/config/config.ini.php" "$tmpdir/config.ini.php" + # 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" --keep="$final_path/config/config.ini.php" + ynh_setup_source --dest_dir="$final_path" + cp -a "$tmpdir/config.ini.php" "$final_path/config/config.ini.php" + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" + + ynh_exec_as $app php${phpversion} $final_path/console core:update -n fi fi @@ -116,16 +134,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" -#================================================= -# SPECIFIC UPGRADE -#================================================= - #================================================= # SETUP A CRON #================================================= ynh_script_progression --message="Setuping a cron..." ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # RELOAD NGINX