1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dolibarr_ynh.git synced 2024-09-03 18:35:53 +02:00

Merge pull request #52 from YunoHost-Apps/testing

Update scripts and version to 12.0.5
This commit is contained in:
mastereur 2021-03-24 16:10:19 +01:00 committed by GitHub
commit 87c6e77c72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 108 additions and 120 deletions

View file

@ -1,7 +1,7 @@
# Dolibarr for YunoHost # Dolibarr for YunoHost
[![Integration level](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg)
[![Install Dolibarr with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=dolibarr) [![Install Dolibarr with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -11,7 +11,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
## Overview ## Overview
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
**Shipped version:** 12.0.4 **Shipped version:** 12.0.5
## Screenshots ## Screenshots
@ -57,8 +57,7 @@ Use the admin panel of your dolibarr to configure this app.
--- ---
Developers info ## Developers info
----------------
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing). Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing).

View file

@ -1,7 +1,7 @@
# Dolibarr pour YunoHost # Dolibarr pour YunoHost
[![Integration level](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg)
[![Installer Dolibarr avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=dolibarr) [![Installer Dolibarr avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble ## Vue d'ensemble
Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.). Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.).
**Version incluse :** 12.0.4 **Version incluse :** 12.0.5
## Captures d'écran ## Captures d'écran
@ -57,8 +57,7 @@ Utilisez le panneau d'administration de votre Dolibarr pour configurer cette app
--- ---
Informations pour les développeurs ## Informations pour les développeurs
----------------
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing).

View file

@ -22,14 +22,12 @@
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
path="/path" (PATH) path="/path" (PATH)
admin="john" (USER) admin="john" (USER)
member=0 member=1
; Checks ; Checks
setup_sub_dir=1 setup_sub_dir=1
setup_root=1 setup_root=1
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
;;; Levels
Level 5=auto
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
@ -37,4 +35,3 @@ Notification=none
; commit=CommitHash ; commit=CommitHash
name=5 Jul 2019 name=5 Jul 2019
manifest_arg=domain=DOMAIN&path=PATH&admin=USER& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/12.0.4.tar.gz SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/12.0.5.tar.gz
SOURCE_SUM=830ddec037616f977547831d8aebf09b7c1b2442c7051375dc1a0a2274d65235 SOURCE_SUM=b60b124ebcd294375f6200cc0683449e475b5dec687f8317b820fc8ec1413d21
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -24,7 +24,7 @@ location __PATH__/ {
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_read_timeout 600; fastcgi_read_timeout 600;
} }
# Include SSOWAT user panel. # Include SSOWAT user panel.

View file

@ -3,10 +3,10 @@
"id": "dolibarr", "id": "dolibarr",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Manage the various aspects of your business or association (contacts, invoices, orders, stocks, agenda, etc...).", "en": "Manage the various aspects of your business or association.",
"fr": "Gérez les différents aspects de votre activité pro ou associative (contacts, factures, commandes, stocks, agenda, etc...)." "fr": "Gérez les différents aspects de votre activité pro ou associative."
}, },
"version": "12.0.4~ynh1", "version": "12.0.5~ynh1",
"url": "https://www.dolibarr.org/", "url": "https://www.dolibarr.org/",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
@ -14,12 +14,12 @@
"url": "https://github.com/mastereur" "url": "https://github.com/mastereur"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.8.0" "yunohost": ">= 4.0.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
@ -56,8 +56,8 @@
"name": "member", "name": "member",
"type": "boolean", "type": "boolean",
"ask": { "ask": {
"en": "Should YunoHost users also be added as members awaiting approval in Dolibarr?", "en": "Add YunoHost users as members waiting for validation in Dolibarr ? (Useful mainly for associations)",
"fr": "Les utilisateurs YunoHost doivent-ils aussi être ajoutés comme adhérents en attente de validation dans Dolibarr ?" "fr": "Ajouter les utilisateurs YunoHost comme adhérents en attente de validation dans Dolibarr ? (Utile pour les associations)"
}, },
"default": false "default": false
} }

View file

@ -1,14 +1,16 @@
## Problem ## Problem
- *Normalization from example_ynh and some rework* - *Description of why you made this PR*
## Solution ## Solution
- *easier yunohost integration* - *And how do you fix that problem*
## PR Status ## PR Status
- [X] Code finished. - [ ] Code finished.
- [X] Tested with Package_check. - [ ] Tested with Package_check.
- [X] Fix or enhancement tested. - [ ] Fix or enhancement tested.
- [X] Upgrade from last version tested. - [ ] Upgrade from last version tested.
- [X] Can be reviewed and tested. - [ ] Can be reviewed and tested.
- [X] Upgrade php version
- [X] Update dependancies ## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -18,7 +18,6 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-mysql \
php${YNH_PHP_VERSION}-xml \ php${YNH_PHP_VERSION}-xml \
php${YNH_PHP_VERSION}-fileinfo" php${YNH_PHP_VERSION}-fileinfo"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================

View file

@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -36,30 +37,26 @@ ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
ynh_print_info --message="Backing up logrotate configuration..."
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"

View file

@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=1 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -67,7 +67,7 @@ fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=1 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -106,7 +106,7 @@ ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -26,7 +26,6 @@ admin=$YNH_APP_ARG_ADMIN
member=$YNH_APP_ARG_MEMBER member=$YNH_APP_ARG_MEMBER
is_public=0 is_public=0
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
@ -78,14 +77,6 @@ ynh_setup_source --dest_dir="$final_path"
datadir=$final_path/documents datadir=$final_path/documents
touch $final_path/htdocs/conf/conf.php touch $final_path/htdocs/conf/conf.php
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -97,11 +88,27 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring php-fpm and install dependencies..." --weight=2 ynh_script_progression --message="Configuring PHP-FPM and install dependencies..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --usage=medium --footprint=medium --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" ynh_add_fpm_config --usage=medium --footprint=medium --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
# Used by ynh_add_nginx_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
# If phpversion doesn't exist, create it
if [ -z "$phpversion" ]; then
phpversion="$YNH_PHP_VERSION"
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
@ -128,7 +135,6 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_fil
ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook" ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook"
ynh_replace_string --match_string="__SRCPATH__" --replace_string="$final_path" --target_file="$fhook" ynh_replace_string --match_string="__SRCPATH__" --replace_string="$final_path" --target_file="$fhook"
#================================================= #=================================================
# SETUP APPLICATION WITH CURL # SETUP APPLICATION WITH CURL
#================================================= #=================================================
@ -136,14 +142,12 @@ ynh_replace_string --match_string="__SRCPATH__" --replace_string="$final_path" -
# Set right permissions for curl install # Set right permissions for curl install
chown -R $app: "$final_path" chown -R $app: "$final_path"
# Set the app as temporarily public for curl call # Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
ynh_app_setting_set --app=$app --key=skipped_uris --value="/" # Set the app as temporarily public for cURL call
# Reload SSOwat config ynh_permission_update --permission="main" --add="visitors"
yunohost app ssowatconf
# Reload Nginx # Reload NGINX
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl # Installation with curl
@ -178,7 +182,7 @@ ynh_local_curl "/install/step5.php" \
"pass=$password" \ "pass=$password" \
"pass_verif=$password" "pass_verif=$password"
ynh_script_progression --message="configuring ldap" --weight=1 ynh_script_progression --message="configuring LDAP" --weight=1
# Populate the LDAP parameters # Populate the LDAP parameters
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql
@ -187,9 +191,9 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ..
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql
if php $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then if php $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then
ynh_print_info --message="ldap user update ok" ynh_print_info --message="LDAP user update ok"
else else
ynh_print_warn --message="ldap user update ended with error" ynh_print_warn --message="LDAP user update ended with error"
fi fi
# If YNH users should be members, populate the database accordingly, create the member list, and sync members # If YNH users should be members, populate the database accordingly, create the member list, and sync members
@ -198,18 +202,12 @@ then
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_member.sql ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_member.sql
if php $final_path/scripts/members/sync_members_ldap2dolibarr.php commitiferror 1 --server=localhost -y; then if php $final_path/scripts/members/sync_members_ldap2dolibarr.php commitiferror 1 --server=localhost -y; then
ynh_print_info --message="ldap member update ok" ynh_print_info --message="LDAP member update ok"
else else
ynh_print_warn --message="ldap member update ended with error" ynh_print_warn --message="LDAP member update ended with error"
fi fi
fi fi
# Remove the public access
if [ $is_public -eq 0 ]
then
ynh_app_setting_delete --app=$app --key=skipped_uris
fi
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
@ -249,20 +247,20 @@ ynh_use_logrotate --logfile="$final_path/documents/dolibarr.log"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary or protect it
if [ $is_public -eq 1 ] if [ $is_public -eq 0 ]
then then
ynh_permission_update --permission "main" --add "visitors" ynh_permission_update --permission="main" --remove="visitors"
fi fi
ynh_permission_create --permission "public access" --url "/public/" --allowed "visitors" ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -43,7 +43,7 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
@ -51,7 +51,7 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing php-fpm configuration..." --weight=1 ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
ynh_remove_fpm_config ynh_remove_fpm_config

View file

@ -33,6 +33,7 @@ datadir=$final_path/documents/
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
@ -67,21 +68,16 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
chown -R root: $final_path
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Reconfiguring PHP-FPM..." ynh_print_info --message="Reconfiguring PHP-FPM..."
ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" # 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"
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" # Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion --package="$extra_php_dependencies"
#================================================= #=================================================
@ -117,10 +113,10 @@ chmod go-w $datadir
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$YNH_PHP_VERSION-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -29,6 +29,7 @@ datadir=$final_path/documents/
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -77,6 +78,15 @@ if [ -z "$fpm_usage" ]; then
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi fi
# If phpversion doesn't exist, create it
if [ -z "$phpversion" ]; then
phpversion="$YNH_PHP_VERSION"
fi
if ! ynh_permission_exists --permission "public_space"; then
ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -91,18 +101,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
# N.B. : this is for app installations before YunoHost 2.7
# where this value might be something like /foo/ or foo/
# instead of /foo ....
# If nobody installed your app before 2.7, then you may
# safely remove this line
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -120,10 +118,10 @@ fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config YNH_PHP_VERSION ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -136,17 +134,23 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Delete old static pool.d conf # If php has changed, remove the old fpm config file
old_php_version=7.0 if [ "$phpversion" != $YNH_PHP_VERSION ]
if [ -f "/etc/php/$old_php_version/fpm/pool.d/$app.conf" ]; then then
ynh_secure_remove --file="/etc/php/$old_php_version/fpm/pool.d/$app.conf" ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then
ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini"
fi
ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
phpversion="$YNH_PHP_VERSION"
fi fi
# Create a dedicated php-fpm config # Recreate a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -171,17 +175,17 @@ then
# Upgrade with CURL # Upgrade with CURL
pushd $final_path/htdocs/install/ pushd $final_path/htdocs/install/
if php upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then if php$phpversion upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then
ynh_print_info --message="Step 1 upgrading ended successfully" ynh_print_info --message="Step 1 upgrading ended successfully"
else else
ynh_print_warn --message="Step 1 upgrading ended with error" ynh_print_warn --message="Step 1 upgrading ended with error"
fi fi
if php upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then if php$phpversion upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then
ynh_print_info --message="Step 2 upgrading ended successfully" ynh_print_info --message="Step 2 upgrading ended successfully"
else else
ynh_print_warn --message="Step 2 upgrading ended with error" ynh_print_warn --message="Step 2 upgrading ended with error"
fi fi
if php step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then if php$phpversion step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then
ynh_print_info --message="Step 3 upgrading ended successfully" ynh_print_info --message="Step 3 upgrading ended successfully"
else else
ynh_print_warn --message="Step 3 upgrading ended with error" ynh_print_warn --message="Step 3 upgrading ended with error"
@ -226,21 +230,18 @@ chmod go-w $datadir
#================================================= #=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary # Create the public space permission if needed
if [ $is_public -eq 1 ] if ! ynh_permission_exists --permission "public_space"; then
then ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi fi
ynh_permission_create --permission "public access" --url "/public/" --allowed "visitors"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT