1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/matomo_ynh.git synced 2024-09-03 19:45:56 +02:00
This archive contains the git sub-modules such as the tag manager for example

Co-authored-by: Lemonsu Loïc <lolusab@users.noreply.github.com>
This commit is contained in:
Éric Gaspar 2021-07-10 18:27:01 +02:00 committed by GitHub
parent 1d967a7511
commit f05c4f0352
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 128 additions and 147 deletions

View file

@ -1,3 +1,8 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Matomo for YunoHost
[![Integration level](https://dash.yunohost.org/integration/matomo.svg)](https://dash.yunohost.org/appci/app/matomo) ![](https://ci-apps.yunohost.org/ci/badges/matomo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/matomo.maintain.svg)
@ -5,21 +10,22 @@
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Matomo quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.*
> *This package allows you to install Matomo quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Matomo is the leading Free/Libre open analytics platform. It is a full-featured PHP MySQL software program that you download and install on your own webserver. At the end of the five-minute installation process, you will be given a JavaScript code. Simply copy and paste this tag on websites you wish to track and access your analytics reports in real-time.
**Shipped version:** 4.3.1
Open source analytics platform for measuring Web statistics
**Shipped version:** 4.3.1~ynh2
**Demo:** https://demo.matomo.org
## Screenshots
![](https://img.matomo.org/spai/w_660+q_lossless+ret_img+to_webp/https://static.matomo.org/wp-content/uploads/2019/03/matomo-analytics-dashboard.png)
![](./doc/screenshots/screenshot.png)
## Demo
* [Official demo](https://demo.matomo.org)
## Disclaimers / important information
## Configuration
@ -27,24 +33,14 @@ Matomo is the leading Free/Libre open analytics platform. It is a full-featured
1. The MySQL database credentials will be sent to the **admin mail**. Fill these details while doing the registration process.
1. No LDAP support yet for the app.
## Documentation
## Documentation and resources
* Official documentation: https://matomo.org/docs
* YunoHost documentation: https://yunohost.org/en/app_matomo
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/matomo.svg)](https://ci-apps.yunohost.org/ci/apps/matomo/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/matomo.svg)](https://ci-apps-arm.yunohost.org/ci/apps/matomo/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/matomo_ynh/issues
* App website: https://matomo.org/
* Upstream app repository: https://github.com/matomo-org/matomo
* YunoHost website: https://yunohost.org/
---
* Official app website: https://matomo.org
* Official user documentation: https://yunohost.org/en/app_matomo
* Official admin documentation: https://matomo.org/docs
* Upstream app code repository: https://github.com/matomo-org/matomo
* YunoHost documentation for this app: https://yunohost.org/app_matomo
* Report a bug: https://github.com/YunoHost-Apps/matomo_ynh/issues
## Developer info
@ -56,3 +52,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/matomo_ynh/tree/testi
or
sudo yunohost app upgrade matomo -u https://github.com/YunoHost-Apps/matomo_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

View file

@ -3,23 +3,25 @@
[![Niveau d'intégration](https://dash.yunohost.org/integration/matomo.svg)](https://dash.yunohost.org/appci/app/matomo) ![](https://ci-apps.yunohost.org/ci/badges/matomo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/matomo.maintain.svg)
[![Installer Matomo avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=matomo)
*[Read this readme in english.](./README.md)*
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Matomo rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/install) pour apprendre comment l'installer.*
> *Ce package vous permet d'installer Matomo rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Matomo est une plateforme d'analyse open source de mesure de statistiques Web. Il s'agit d'un logiciel PHP MySQL complet que vous téléchargez et installez sur votre propre serveur Web. À la fin du processus d'installation de cinq minutes, vous recevrez un code JavaScript. Copiez et collez simplement cette balise sur les sites Web que vous souhaitez suivre et accédez à vos rapports d'analyse en temps réel.
**Version incluse :** 4.3.1
Plateforme d'analyse open source de mesure de statistiques Web
**Version incluse :** 4.3.1~ynh2
**Démo :** https://demo.matomo.org
## Captures d'écran
![](https://img.matomo.org/spai/w_660+q_lossless+ret_img+to_webp/https://static.matomo.org/wp-content/uploads/2019/03/matomo-analytics-dashboard.png)
![](./doc/screenshots/screenshot.png)
## Démo
* [Démo officielle](https://demo.matomo.org)
## Avertissements / informations importantes
## Configuration
@ -27,24 +29,14 @@ Matomo est une plateforme d'analyse open source de mesure de statistiques Web. I
1. Les informations d'identification de la base de données MySQL seront envoyées à **l'email admin**. Remplissez ces détails lors du processus d'inscription.
1. Le support LDAP n'est pas encore implémenté pour cette l'application.
## Documentation
## Documentations et ressources
* Documentation officielle : https://matomo.org/docs
* Documentation YunoHost : https://yunohost.org/fr/app_matomo
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/matomo.svg)](https://ci-apps.yunohost.org/ci/apps/matomo/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/matomo.svg)](https://ci-apps-arm.yunohost.org/ci/apps/matomo/)
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/matomo_ynh/issues
* Site de l'application : https://matomo.org/
* Dépôt de l'application principale : https://github.com/matomo-org/matomo
* Site web YunoHost : https://yunohost.org/
---
* Site officiel de l'app : https://matomo.org
* Documentation officielle utilisateur : https://yunohost.org/en/app_matomo
* Documentation officielle de l'admin : https://matomo.org/docs
* Dépôt de code officiel de l'app : https://github.com/matomo-org/matomo
* Documentation YunoHost pour cette app : https://yunohost.org/app_matomo
* Signaler un bug : https://github.com/YunoHost-Apps/matomo_ynh/issues
## Informations pour les développeurs
@ -56,3 +48,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/matomo_ynh/tree/testi
ou
sudo yunohost app upgrade matomo -u https://github.com/YunoHost-Apps/matomo_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -11,10 +11,15 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=1d3e9f3dbf72a6a124c879fa549ab8107367e36a
#4.3.0 (#47)
upgrade=1 from_commit=1d967a751135c3801ef95cf989ab3fb9e45e6f70
backup_restore=1
multi_instance=1
change_url=1
;;; Options
Email=anmol@datamol.org
Notification=yes
;;; Upgrade options
; commit=1d967a751135c3801ef95cf989ab3fb9e45e6f70
name= 4.3.0 (#47)
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/matomo-org/matomo/archive/refs/tags/4.3.1.tar.gz
SOURCE_SUM=1b81dff17dd35e1b3a1fe6a5fe28a2916c5fb5537bf3fafc13020f52becf888a
SOURCE_URL=https://builds.matomo.org/matomo-4.3.1.tar.gz
SOURCE_SUM=55ee0fd5c555fee679f4171069464b4d33b0a635fbbdea1ff6347497763dc4e4
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1,2 +1,2 @@
MAILTO="admin"
MAILTO="__EMAIL__"
5 * * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/console core:archive --url=https://__DOMAIN____PATH__ > /dev/null

View file

@ -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=

View file

@ -6,7 +6,7 @@
"en": "Open source analytics platform for measuring Web statistics",
"fr": "Plateforme d'analyse open source de mesure de statistiques Web"
},
"version": "4.3.1~ynh1",
"version": "4.3.1~ynh2",
"url": "https://matomo.org",
"upstream": {
"license": "GPL-3.0-or-later",
@ -43,6 +43,11 @@
"example": "/matomo",
"default": "/matomo"
},
{
"name": "admin",
"type": "user",
"example": "johndoe"
},
{
"name": "is_public",
"type": "boolean",

View file

@ -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
#=================================================

View file

@ -29,6 +29,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
email=$(ynh_user_get_info --username=$admin --key=mail)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -95,11 +96,13 @@ fi
#=================================================
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setuping a cron..."
ynh_script_progression --message="Setuping a cron..." --weight=1
path=$new_path
domain=$new_domain
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

View file

@ -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
@ -29,7 +31,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -40,7 +42,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
@ -48,7 +50,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..."
ynh_script_progression --message="Creating a MySQL database..." --weight=1
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
@ -58,7 +60,7 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
@ -66,7 +68,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -80,7 +82,7 @@ chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -88,36 +90,25 @@ ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
ynh_script_progression --message="Configuring PHP-FPM..." --weight=3
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL COMPOSER AND DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing Composer and dependencies..."
ynh_install_composer
# Install missing icons
ynh_setup_source --dest_dir="$final_path/plugins/Morpheus/icons" --source_id="icons"
chmod -R 755 "$final_path/plugins/Morpheus"
#=================================================
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setuping a cron..."
ynh_script_progression --message="Setuping a cron..." --weight=1
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
@ -128,14 +119,14 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
ynh_script_progression --message="Sending a readme for the admin..." --weight=1
message="Matomo was successfully installed :)
@ -156,4 +147,4 @@ ynh_send_readme_to_admin "$message"
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Matomo completed"
ynh_script_progression --message="Installation of Matomo completed" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..."
ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
@ -34,7 +34,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing Matomo main directory..."
ynh_script_progression --message="Removing Matomo main directory..." --weight=2
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -42,7 +42,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
@ -50,7 +50,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..."
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
@ -60,7 +60,7 @@ ynh_remove_fpm_config
#=================================================
# REMOVE THE CRON FILE
#=================================================
ynh_script_progression --message="Removing the cron file..."
ynh_script_progression --message="Removing the cron file..." --weight=1
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
@ -70,7 +70,7 @@ ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
@ -79,4 +79,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of Matomo completed"
ynh_script_progression --message="Removal of Matomo completed" --last

View file

@ -20,7 +20,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..."
ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -34,7 +34,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
@ -46,14 +46,14 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
@ -61,7 +61,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring Matomo main directory..."
ynh_script_progression --message="Restoring Matomo main directory..." --weight=3
ynh_restore_file --origin_path="$final_path"
@ -72,7 +72,7 @@ chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..."
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=2
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
@ -83,7 +83,7 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..."
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
@ -92,7 +92,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_script_progression --message="Restoring the cron file..."
ynh_script_progression --message="Restoring the cron file..." --weight=1
ynh_restore_file --origin_path="/etc/cron.d/$app"
@ -101,7 +101,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
@ -110,4 +110,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for Matomo"
ynh_script_progression --message="Restoration completed for Matomo" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -21,18 +21,20 @@ 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
#=================================================
ynh_script_progression --message="Checking version..."
ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
@ -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
@ -56,7 +63,7 @@ fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
@ -64,7 +71,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up Matomo before upgrading (may take a while)..."
ynh_script_progression --message="Backing up Matomo before upgrading (may take a while)..." --weight=3
# Backup the current version of the app
ynh_backup_before_upgrade
@ -83,7 +90,7 @@ ynh_abort_if_errors
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
ynh_script_progression --message="Upgrading source files..." --weight=3
if [[ ! -f "$final_path/config/config.ini.php" ]]; then
# config.ini.php is only created during the post-install process...
@ -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
@ -103,7 +121,7 @@ chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -111,48 +129,24 @@ ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
#=================================================
# SPECIFIC UPGRADE
#=================================================
# INSTALL COMPOSER AND DEPENDENCIES
#=================================================
ynh_script_progression --message="Installating composer and dependencies..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
if [[ -f "$final_path/config/config.ini.php" ]]; then
php$phpversion $final_path/console core:update -n
fi
fi
#=================================================
# INSTALL MISSING ICONS
#=================================================
if [ ! "$(ls -A "$final_path/plugins/Morpheus/icons")" ]
then
ynh_script_progression --message="Installating Morpheus icons..."
ynh_setup_source --dest_dir="$final_path/plugins/Morpheus/icons" --source_id="icons"
chmod -R 755 "$final_path/plugins/Morpheus"
fi
#=================================================
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setuping a cron..."
ynh_script_progression --message="Setuping a cron..." --weight=1
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
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -160,4 +154,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of Matomo completed"
ynh_script_progression --message="Upgrade of Matomo completed" --last