mirror of
https://github.com/YunoHost-Apps/dolibarr_ynh.git
synced 2024-09-03 18:35:53 +02:00
commit
e20d23136a
13 changed files with 63 additions and 109 deletions
|
@ -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)*
|
||||||
|
|
||||||
|
@ -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).
|
||||||
|
|
||||||
|
|
|
@ -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)*
|
||||||
|
|
||||||
|
@ -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).
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
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&
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
"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": "13.0.0~ynh1",
|
"version": "13.0.0~ynh1",
|
||||||
"url": "https://www.dolibarr.org/",
|
"url": "https://www.dolibarr.org/",
|
||||||
|
@ -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": {
|
||||||
|
|
|
@ -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!"*
|
||||||
|
|
|
@ -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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -81,7 +80,7 @@ touch $final_path/htdocs/conf/conf.php
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring nginx web server..." --weight=1
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -97,10 +96,10 @@ 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 --package="$extra_php_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -128,7 +127,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 +134,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 +174,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 +183,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 +194,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 +239,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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,22 +68,14 @@ 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"
|
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"
|
|
||||||
|
|
||||||
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
@ -117,9 +110,9 @@ 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=php$phpversion-fpm --action=reload
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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,10 @@ 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 ! 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 +96,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 +113,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,7 +129,7 @@ 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
|
# Delete old static pool.d conf
|
||||||
old_php_version=7.0
|
old_php_version=7.0
|
||||||
|
@ -145,8 +138,7 @@ if [ -f "/etc/php/$old_php_version/fpm/pool.d/$app.conf" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create 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 --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
@ -171,17 +163,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"
|
||||||
|
@ -221,24 +213,10 @@ mkdir -p "$datadir"
|
||||||
chown -R $app: "$datadir"
|
chown -R $app: "$datadir"
|
||||||
chmod go-w $datadir
|
chmod go-w $datadir
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
|
|
||||||
|
|
||||||
# Make app public if necessary
|
|
||||||
if [ $is_public -eq 1 ]
|
|
||||||
then
|
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway
|
|
||||||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
|
||||||
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..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue