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

Update to 14.0.3 & Cleaning up

Update to 14.0.3 & Cleaning up
This commit is contained in:
mastereur 2021-10-21 20:33:08 +02:00 committed by GitHub
commit 093a6b58b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 134 additions and 232 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.
-->
# 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)
@ -5,61 +10,33 @@
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install Dolibarr quickly and simply on a YunoHost server. > *This package allows you to install Dolibarr quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## 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:** 14.0.2 **Shipped version:** 14.0.3~ynh1
**Demo:** https://www.dolibarr.org/onlinedemo
## Screenshots ## Screenshots
![Screenshot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png) ![](./doc/screenshots/screenshot.jpg)
## Demo ## Documentation and resources
* [Official demo](https://www.dolibarr.org/onlinedemo) * Official app website: https://www.dolibarr.org/
* Official user documentation: https://www.dolibarr.org/#features
* Official admin documentation: https://www.dolibarr.org/documentation-home
* Upstream app code repository: https://github.com/Dolibarr/dolibarr
* YunoHost documentation for this app: https://yunohost.org/app_dolibarr
* Report a bug: https://github.com/YunoHost-Apps/dolibarr_ynh/issues
## Configuration ## Developer info
Use the admin panel of your dolibarr to configure this app. Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing).
## Documentation
* Official documentation: https://www.dolibarr.org/documentation-home
## YunoHost specific features
#### Multi-users support
* LDAP and HTTP auth supported: **Yes**
* The app can be used by multiple users: **Yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/dolibarr%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/dolibarr/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/dolibarr%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/dolibarr/)
## Limitations
* Dolibarr must be a non-public application to be able to link YunoHost accounts.
* The deletion of an account is not taken into account in Dolibarr.
## Additional information
## Links
* Report a bug: https://github.com/YunoHost-Apps/dolibarr_ynh/issues
* App website: https://www.dolibarr.org
* Upstream app repository: https://github.com/Dolibarr/dolibarr
* YunoHost website: https://yunohost.org/
---
## Developers info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` ```
@ -67,3 +44,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/tes
or or
sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

View file

@ -1,61 +1,34 @@
# 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) [![Niveau d'intégration](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.svg)](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)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Dolibarr rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Dolibarr 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.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## 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 :** 14.0.2 **Version incluse :** 14.0.3~ynh1
**Démo :** https://www.dolibarr.org/onlinedemo
## Captures d'écran ## Captures d'écran
![Screenshot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png) ![](./doc/screenshots/screenshot.jpg)
## Démo ## Documentations et ressources
* [Démo officielle](https://www.dolibarr.fr/demo-en-ligne) * Site officiel de l'app : https://www.dolibarr.org/
* Documentation officielle utilisateur : https://www.dolibarr.org/#features
## Configuration * Documentation officielle de l'admin : https://www.dolibarr.org/documentation-home
* Dépôt de code officiel de l'app : https://github.com/Dolibarr/dolibarr
Utilisez le panneau d'administration de votre Dolibarr pour configurer cette application. * Documentation YunoHost pour cette app : https://yunohost.org/app_dolibarr
* Signaler un bug : https://github.com/YunoHost-Apps/dolibarr_ynh/issues
## Documentation
* Documentation officielle : https://www.dolibarr.fr/documentation
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateurs
* L'authentification LDAP et HTTP est prise en charge
* L'application peut être utilisée par plusieurs utilisateurs.
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/dolibarr%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/dolibarr/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/dolibarr%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/dolibarr/)
## Limitations
* Dolibarr doit être une application non publique pour pouvoir lier les comptes YunoHost.
* La suppression d'un compte n'est pas prise en compte dans Dolibarr.
## Informations additionnelles
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/dolibarr_ynh/issues
* Site de l'application : https://www.dolibarr.fr
* Dépôt de l'application principale : https://github.com/Dolibarr/dolibarr
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs ## Informations pour les développeurs
@ -67,3 +40,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/tes
ou ou
sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,8 +1,8 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) admin="john"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1

View file

@ -1,6 +1,5 @@
SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/14.0.2.tar.gz SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/14.0.3.tar.gz
SOURCE_SUM=5747d7518115ad94b96606b00aad7fc687b1404bb5d838a0aef1d900998fc846 SOURCE_SUM=38a9dddb576501aa88ec5079e8eb7d8a6f99beee19660820830924b7622fc0d6
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.).

0
doc/DISCLAIMER.md Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
app=__APP__ app=__APP__
src_path=__SRCPATH__ src_path=__FINALPATH__
member=__MEMBER__ member=__MEMBER__
# Sync users # Sync users

View file

@ -3,18 +3,26 @@
"id": "dolibarr", "id": "dolibarr",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Manage the various aspects of your business or association.", "en": "Manage the various aspects of your business or association",
"fr": "Gérez les différents aspects de votre activité pro ou associative." "fr": "Gérez les différents aspects de votre activité pro ou associative"
}, },
"version": "14.0.2~ynh1", "version": "14.0.3~ynh1",
"url": "https://www.dolibarr.org/", "url": "https://www.dolibarr.org/",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://www.dolibarr.org/",
"demo": "https://www.dolibarr.org/onlinedemo",
"admindoc": "https://www.dolibarr.org/documentation-home",
"userdoc": "https://www.dolibarr.org/#features",
"code": "https://github.com/Dolibarr/dolibarr"
},
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "mastereur", "name": "mastereur",
"url": "https://github.com/mastereur" "url": "https://github.com/mastereur"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.0.0" "yunohost": ">= 4.2.4"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -26,31 +34,17 @@
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"ask": {
"en": "Choose a domain name for Dolibarr",
"fr": "Choisissez un nom de domaine pour Dolibarr"
},
"example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Dolibarr",
"fr": "Choisissez un chemin pour Dolibarr"
},
"example": "/dolibarr", "example": "/dolibarr",
"default": "/dolibarr" "default": "/dolibarr"
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user"
"ask": {
"en": "Choose an admin user",
"fr": "Choisissez ladministrateur"
},
"example": "johndoe"
} }
] ]
} }

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## 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

@ -24,7 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
member=0 member=0
is_public=0 #is_public=0
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -47,10 +47,18 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public #ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=member --value=$member ynh_app_setting_set --app=$app --key=member --value=$member
ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json") ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json")
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -80,30 +88,15 @@ 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
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
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"
# Used by ynh_add_nginx_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) 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 # NGINX CONFIGURATION
#================================================= #=================================================
@ -117,15 +110,9 @@ ynh_add_nginx_config
#================================================= #=================================================
# PREPARE AND INSTALL APP # PREPARE AND INSTALL APP
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
finstall="$final_path/htdocs/install/install.forced.php" ynh_add_config --template="../conf/install.forced.php" --destination="$final_path/htdocs/install/install.forced.php"
cp ../conf/install.forced.php "$finstall"
# Change variables in Dolibarr configuration
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$finstall"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$finstall"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$finstall"
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$finstall"
#================================================= #=================================================
# CONFIGURE THE HOOK FILE FOR USER CREATE # CONFIGURE THE HOOK FILE FOR USER CREATE
@ -133,7 +120,7 @@ ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target
fhook=../hooks/post_user_create fhook=../hooks/post_user_create
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook"
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="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook"
#================================================= #=================================================
# SETUP APPLICATION WITH CURL # SETUP APPLICATION WITH CURL
@ -199,6 +186,9 @@ else
ynh_print_warn --message="LDAP user update ended with error" ynh_print_warn --message="LDAP user update ended with error"
fi fi
# Remove the public access
ynh_permission_update --permission="main" --remove="visitors"
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
@ -221,7 +211,10 @@ ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php"
#================================================= #=================================================
# Set permissions on app files # Set permissions on app files
chown -R $app: "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 644 "$final_path/htdocs/conf/conf.php" chmod 644 "$final_path/htdocs/conf/conf.php"
mkdir -p "$datadir" mkdir -p "$datadir"
chown -R $app: "$datadir" chown -R $app: "$datadir"
@ -240,12 +233,6 @@ ynh_use_logrotate --logfile="$final_path/documents/dolibarr.log"
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
if [ $is_public -eq 0 ]
then
ynh_permission_update --permission="main" --remove="visitors"
fi
# Create the public space permission if needed # Create the public space permission if needed
if ! ynh_permission_exists --permission "public_space"; then if ! ynh_permission_exists --permission "public_space"; then
ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"

View file

@ -40,8 +40,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 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}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
@ -102,7 +100,10 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# Set permissions on app files # Set permissions on app files
chown -R $app: "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 644 "$final_path/htdocs/conf/conf.php" chmod 644 "$final_path/htdocs/conf/conf.php"
mkdir -p "$datadir" mkdir -p "$datadir"
chown -R $app: "$datadir" chown -R $app: "$datadir"

View file

@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
member=$(ynh_app_setting_get --app=$app --key=member) member=$(ynh_app_setting_get --app=$app --key=member)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language) language=$(ynh_app_setting_get --app=$app --key=language)
@ -38,23 +37,25 @@ phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=11
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
else
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If db_name doesn't exist, create it # If db_name doesn't exist, create it
if [ -z "$db_name" ]; then if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
@ -79,24 +80,24 @@ 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 # Cleaning legacy permissions
if [ -z "$phpversion" ]; then if ynh_legacy_permissions_exists; then
phpversion="$YNH_PHP_VERSION" ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission "public_space"; then
ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
fi fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=11 ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Backup the current version of the app # Create a dedicated user (if not existing)
ynh_backup_before_upgrade ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -120,34 +121,26 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
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
#================================================= #=================================================
# 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
# If php has changed, remove the old fpm config file # If php has changed, remove the old fpm config file
if [ "$phpversion" != $YNH_PHP_VERSION ] # if [ "$phpversion" != $YNH_PHP_VERSION ]
then # then
ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/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" # ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then # 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" # ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini"
fi # fi
ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload # ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
phpversion="$YNH_PHP_VERSION" # phpversion="$YNH_PHP_VERSION"
fi # fi
# Recreate a dedicated PHP-FPM config # Recreate a dedicated PHP-FPM config
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -209,11 +202,7 @@ then
popd popd
if [ $is_public -eq 0 ] ynh_permission_update --permission="main" --remove="visitors"
then
ynh_permission_update --permission="main" --remove="visitors"
fi
fi fi
#================================================= #=================================================
@ -223,6 +212,7 @@ fi
ynh_backup_if_checksum_is_different --file="$final_path/htdocs/conf/conf.php" ynh_backup_if_checksum_is_different --file="$final_path/htdocs/conf/conf.php"
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php" ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php"
chmod 644 "$final_path/htdocs/conf/conf.php"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -240,7 +230,7 @@ ynh_use_logrotate --non-append
fhook=../hooks/post_user_create fhook=../hooks/post_user_create
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook"
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="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -249,29 +239,20 @@ ynh_replace_string --match_string="__SRCPATH__" --replace_string="$final_path" -
#================================================= #=================================================
# Set permissions on app files # Set permissions on app files
chown -R $app: "$final_path" chmod 750 "$final_path"
chmod 644 "$final_path/htdocs/conf/conf.php" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
mkdir -p "$datadir" 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
# Create the public space permission if needed
if ! ynh_permission_exists --permission "public_space"; then
ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
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=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