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

Merge pull request #28 from YunoHost-Apps/patch

Patch
This commit is contained in:
Éric Gaspar 2021-07-19 11:55:20 +02:00 committed by GitHub
commit ab91e2fc20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 297 additions and 350 deletions

View file

@ -1,73 +1,55 @@
<!--
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.
-->
# Cheky for YunoHost # Cheky for YunoHost
[![Integration level](https://dash.yunohost.org/integration/cheky.svg)](https://dash.yunohost.org/appci/app/cheky) [![Integration level](https://dash.yunohost.org/integration/cheky.svg)](https://dash.yunohost.org/appci/app/cheky) ![](https://ci-apps.yunohost.org/ci/badges/cheky.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/cheky.maintain.svg)
[![Install Cheky with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=cheky) [![Install Cheky with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=cheky)
> *This package allow you to install cheky quickly and simply on a YunoHost server. *[Lire ce readme en français.](./README_fr.md)*
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
**Shipped version:** 4.4.1 > *This package allows you to install Cheky quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Monitors French classifieds websites LeBonCoin and SeLoger
**Shipped version:** 4.4.1~ynh5
## Disclaimers / important information
## Features ## Features
### Français
* [Cheky](https://www.cheky.net) vous permet de créer des alertes [Leboncoin](http://leboncoin.fr/) et des alertes [SeLoger](http://www.seloger.com/).
* Vous pouvez ainsi suivre gratuitement, en fonction de vos critères de recherche, les nouvelles annonces mises en ligne sur ces sites internet.
* Les alertes peuvent être envoyées par mail, flux RSS et SMS.
### English
* [Cheky](https://www.cheky.net) allows you to create various alerts for french classifieds ads website like [Leboncoin](http://leboncoin.fr/) and [SeLoger](http://www.seloger.com/). * [Cheky](https://www.cheky.net) allows you to create various alerts for french classifieds ads website like [Leboncoin](http://leboncoin.fr/) and [SeLoger](http://www.seloger.com/).
* If you do not live in France, it will not be really useful for you * If you do not live in France, it will not be really useful for you
## Limitations ## Limitations
* Pas de mise à jour automatique depuis l'ancien package [LBCAlerte](https://github.com/YunoHost-Apps/LBCAlerte_ynh) * No automatic update from the old package [LBCAlerte](https://github.com/YunoHost-Apps/LBCAlerte_ynh)
* Application en français uniquement * Application in French only
* Ne fonctionne pas avec le SSO (comptes admin/utilisateurs séparés). * Does not work with SSO (separate admin / user accounts).
## Additionnal informations ## Documentation and resources
* Anciennement nommé LBCAlerte. Renommé depuis la [version 3.4](https://www.cheky.net/changelog#v3_4)
## Links
* Official app website: https://www.cheky.net
* Upstream app code repository: https://github.com/Blount/Cheky
* YunoHost documentation for this app: https://yunohost.org/app_cheky
* Report a bug: https://github.com/YunoHost-Apps/cheky_ynh/issues * Report a bug: https://github.com/YunoHost-Apps/cheky_ynh/issues
* Cheky website: https://www.cheky.net
* Cheky changelog : https://github.com/Blount/Cheky/blob/master/CHANGELOG.txt
* YunoHost website: https://yunohost.org
--- ## Developer info
## Informations pour développeurs et développeuses Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/cheky_ynh/tree/testing).
**Si vous savez ce que vous faites ET que vous souhaitez passer sur une version instable pour tester ou coder** To try the testing branch, please proceed like that.
```
Au lieu de fusionner directement dans `master`, merci d'envoyer vos "pull request" dans la [branche de test `testing`](https://github.com/YunoHost-Apps/cheky_ynh/tree/testing)
Pour basculer sur la branche `testing`, merci de procéder ainsi:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug
or or
sudo yunohost app upgrade cheky --url https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug sudo yunohost app upgrade cheky -u https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug
``` ```
## Historique des versions **More info regarding app packaging:** https://yunohost.org/packaging_apps
* 4.4.1~ynh4 (11 March 2019)
* changed: upgrade Cheky to 4.4.1
* fix automated upgrade method
* fix scripts `backup` and `restore` - [md-clone](https://github.com/md-clone) with [#19](https://github.com/YunoHost-Apps/cheky_ynh/pull/19)
* 4.4~ynh4 (4 March 2019)
* removed: Debian Jessie support is dropped in favor to Stretch only (Yunohost version > 3)
* changed: follow lastest rules from <https://github.com/YunoHost/example_ynh>
* fixed: remove old php file <https://github.com/YunoHost/example_ynh/pull/52>
* changed: increment YunoHost package version to `ynh4`
* 24 Feb 2019 [#16](https://github.com/YunoHost-Apps/cheky_ynh/pull/16) - Mise à jour vers la version 4.4
* 24 Sep 2018 [#11](https://github.com/YunoHost-Apps/cheky_ynh/pull/11) - Mise à jour vers la version 4.3.5
* 14 Sep 2018 [10](https://github.com/YunoHost-Apps/cheky_ynh/pull/10) - Correction images dans "annonces sauvegardées"
* 3 Sep 2018 [#8](https://github.com/YunoHost-Apps/cheky_ynh/pull/8) - Mise à jour vers la version 4.3.3
* 8 Aug 2018 [#4](https://github.com/YunoHost-Apps/cheky_ynh/pull/4) - Mise à jour vers la version 4.1
* 9 Aug 2018 [#5](https://github.com/YunoHost-Apps/cheky_ynh/pull/5) - Mise à jour vers la version 4.1

52
README_fr.md Normal file
View file

@ -0,0 +1,52 @@
# Cheky pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/cheky.svg)](https://dash.yunohost.org/appci/app/cheky) ![](https://ci-apps.yunohost.org/ci/badges/cheky.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/cheky.maintain.svg)
[![Installer Cheky avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=cheky)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Cheky rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Surveille pour vous LeBonCoin et SeLoger
**Version incluse :** 4.4.1~ynh5
## Avertissements / informations importantes
## Features
* [Cheky](https://www.cheky.net) vous permet de créer des alertes [Leboncoin](http://leboncoin.fr/) et des alertes [SeLoger](http://www.seloger.com/).
* Vous pouvez ainsi suivre gratuitement, en fonction de vos critères de recherche, les nouvelles annonces mises en ligne sur ces sites internet.
* Les alertes peuvent être envoyées par mail, flux RSS et SMS.
## Limitations
* Pas de mise à jour automatique depuis l'ancien package [LBCAlerte](https://github.com/YunoHost-Apps/LBCAlerte_ynh)
* Application en français uniquement
* Ne fonctionne pas avec le SSO (comptes admin/utilisateurs séparés).
## Documentations et ressources
* Site officiel de l'app : https://www.cheky.net
* Dépôt de code officiel de l'app : https://github.com/Blount/Cheky
* Documentation YunoHost pour cette app : https://yunohost.org/app_cheky
* Signaler un bug : https://github.com/YunoHost-Apps/cheky_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/cheky_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug
ou
sudo yunohost app upgrade cheky -u https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,17 +1,9 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) is_public=1
#language="fr" password="password"
is_public=1 (PUBLIC|public=1|private=0)
password="pass"
#port="666" (PORT)
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -20,25 +12,15 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=a6b2615101887e3235aab0b95607eb1b58507a4c upgrade=1 from_commit=ee9a1c83c800c4bf269a8c798468aaaeb3a9accb
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1
port_already_use=0
change_url=0 change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4:
Level 4=0
# Level 5:
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options
; commit=ee9a1c83c800c4bf269a8c798468aaaeb3a9accb
name=Merge pull request #23 from YunoHost-Apps/testing
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -1 +0,0 @@
*/5 * * * * __USER__ /usr/bin/php -f __FINALPATH__/check.php

1
conf/cron Normal file
View file

@ -0,0 +1 @@
*/5 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINALPATH__/check.php

View file

@ -9,7 +9,6 @@ location __PATH__/ {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
### Example PHP configuration (remove it if not used)
index index.php; index index.php;
# Common parameter to increase upload size limit in conjuction with dedicated php-fpm file # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file
@ -18,7 +17,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
@ -26,7 +25,7 @@ location __PATH__/ {
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;
} }
### End of PHP configuration part
# Very important security restriction # Very important security restriction
# See https://forum.cheky.net/information-sur-message-avertissement-securite-t553-p1.html#p2127 # See https://forum.cheky.net/information-sur-message-avertissement-securite-t553-p1.html#p2127

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port; ; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket. ; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory. ; Note: This value is mandatory.
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog. ; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD) ; Default Value: 511 (-1 on FreeBSD and OpenBSD)
@ -41,7 +41,7 @@ listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
; Set permissions for unix socket, if one is used. In Linux, read/write ; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many ; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions. ; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user ; Default Values: user and group are set as the running user
; mode is set to 0660 ; mode is set to 0660
listen.owner = www-data listen.owner = www-data
@ -131,7 +131,7 @@ pm.max_spare_servers = 3
; Note: Used only when pm is set to 'ondemand' ; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s ; Default Value: 10s
;pm.process_idle_timeout = 10s; ;pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning. ; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For ; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
@ -184,7 +184,7 @@ pm.max_spare_servers = 3
; ;
; By default the status page only outputs short status. Passing 'full' in the ; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process. ; query string will also return status for each pool process.
; Example: ; Example:
; http://www.foo.bar/status?full ; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full ; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full ; http://www.foo.bar/status?html&full
@ -297,7 +297,7 @@ pm.max_spare_servers = 3
; - .... ; - ....
; %p: PID of the child that serviced the request ; %p: PID of the child that serviced the request
; %P: PID of the parent of the child that serviced the request ; %P: PID of the parent of the child that serviced the request
; %q: the query string ; %q: the query string
; %Q: the '?' character if query string exists ; %Q: the '?' character if query string exists
; %r: the request URI (without the query string, see %q and %Q) ; %r: the request URI (without the query string, see %q and %Q)
; %R: remote IP address ; %R: remote IP address
@ -316,40 +316,40 @@ pm.max_spare_servers = 3
; ;
; Default: "%R - %u %t \"%m %r\" %s" ; Default: "%R - %u %t \"%m %r\" %s"
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
; The log file for slow requests ; The log file for slow requests
; Default Value: not set ; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set ; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log ;slowlog = log/$pool.log.slow
; The timeout for serving a single request after which a PHP backtrace will be ; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'. ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0 ; Default Value: 0
request_slowlog_timeout = 5s ;request_slowlog_timeout = 0
; The timeout for serving a single request after which the worker process will ; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option ; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'. ; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0 ; Default Value: 0
request_terminate_timeout = 1d request_terminate_timeout = 1d
; Set open file descriptor rlimit. ; Set open file descriptor rlimit.
; Default Value: system defined value ; Default Value: system defined value
;rlimit_files = 1024 ;rlimit_files = 1024
; Set max core size rlimit. ; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0 ; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value ; Default Value: system defined value
;rlimit_core = 0 ;rlimit_core = 0
; Chroot to this directory at the start. This value must be defined as an ; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used. ; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix ; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead. ; will be used instead.
; Note: chrooting is a great security feature and should be used whenever ; Note: chrooting is a great security feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot ; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...). ; (error_log, sessions.save_path, ...).
; Default Value: not set ; Default Value: not set
@ -383,7 +383,7 @@ chdir = __FINALPATH__
; Note: set an empty value to allow all extensions. ; Note: set an empty value to allow all extensions.
; Default Value: .php ; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5 .php7 ;security.limit_extensions = .php .php3 .php4 .php5 .php7
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment. ; the current environment.
; Default Value: clean env ; Default Value: clean env
@ -397,7 +397,7 @@ chdir = __FINALPATH__
; overwrite the values previously defined in the php.ini. The directives are the ; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI: ; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can ; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'. ; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by ; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set' ; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.

10
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,10 @@
## Features
* [Cheky](https://www.cheky.net) allows you to create various alerts for french classifieds ads website like [Leboncoin](http://leboncoin.fr/) and [SeLoger](http://www.seloger.com/).
* If you do not live in France, it will not be really useful for you
## Limitations
* No automatic update from the old package [LBCAlerte](https://github.com/YunoHost-Apps/LBCAlerte_ynh)
* Application in French only
* Does not work with SSO (separate admin / user accounts).

11
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,11 @@
## Features
* [Cheky](https://www.cheky.net) vous permet de créer des alertes [Leboncoin](http://leboncoin.fr/) et des alertes [SeLoger](http://www.seloger.com/).
* Vous pouvez ainsi suivre gratuitement, en fonction de vos critères de recherche, les nouvelles annonces mises en ligne sur ces sites internet.
* Les alertes peuvent être envoyées par mail, flux RSS et SMS.
## Limitations
* Pas de mise à jour automatique depuis l'ancien package [LBCAlerte](https://github.com/YunoHost-Apps/LBCAlerte_ynh)
* Application en français uniquement
* Ne fonctionne pas avec le SSO (comptes admin/utilisateurs séparés).

View file

@ -3,11 +3,16 @@
"id": "cheky", "id": "cheky",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Cheky monitors French classifieds websites LeBonCoin and SeLoger.", "en": "Monitors French classifieds websites LeBonCoin and SeLoger",
"fr": "Cheky surveille pour vous LeBonCoin et SeLoger." "fr": "Surveille pour vous LeBonCoin et SeLoger"
}, },
"version": "4.4.1~ynh4", "version": "4.4.1~ynh5",
"url": "https://www.cheky.net", "url": "https://www.cheky.net",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://www.cheky.net",
"code": "https://github.com/Blount/Cheky"
},
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "Gofannon", "name": "Gofannon",
@ -27,12 +32,12 @@
} }
], ],
"requirements": { "requirements": {
"yunohost": ">= 3.4" "yunohost": ">= 4.2.4"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
@ -40,38 +45,22 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain name for Cheky",
"fr": "Choisissez un nom de domaine pour Cheky"
},
"example": "example.com" "example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Cheky",
"fr": "Choisissez un chemin pour Cheky"
},
"example": "/cheky", "example": "/cheky",
"default": "/cheky" "default": "/cheky"
}, },
{ {
"name": "password", "name": "password",
"type": "password", "type": "password",
"ask": {
"en": "Password for admin account",
"fr": "Mot de passe compte admin"
},
"example": "password" "example": "password"
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true "default": true
} }
] ]

View file

@ -4,24 +4,12 @@
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
YNH_PHP_VERSION="7.3"
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
# Source : https://github.com/YunoHost-Apps/Experimental_helpers/tree/master/ynh_exec_as
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -23,51 +23,46 @@ ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# STANDARD BACKUP STEPS # DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info "Backing up the main app directory..."
ynh_backup "$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Backing up nginx web server configuration..."
ynh_backup "/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 "Backing up php-fpm configuration..."
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_print_info "Backing up the MySQL database..." ynh_print_info "Backing up the MySQL database..."
ynh_mysql_dump_db "$db_name" > db.sql ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# SPECIFIC BACKUP
#=================================================
# ...
#=================================================
#================================================= #=================================================
# BACKUP A CRON FILE # BACKUP A CRON FILE
#================================================= #=================================================
ynh_backup "/etc/cron.d/$app" ynh_backup --src_path="/etc/cron.d/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -25,86 +25,71 @@ path_url=$YNH_APP_ARG_PATH
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
### The app instance name is available as $YNH_APP_INSTANCE_NAME
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
### The app instance name is probably what interests you most, since this is
### guaranteed to be unique. This is a good unique identifier to define installation path,
### db names, ...
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_print_info "Validating installation parameters..." ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Register (book) web path # Register (book) web path
ynh_webpath_register $app $domain $path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_print_info "Storing installation settings..." ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set $app domain $domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set $app password $password ynh_app_setting_set --app=$app --key=password --value=$password
ynh_app_setting_set $app is_public $is_public
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
ynh_print_info "Creating a MySQL database..." ynh_script_progression --message="Creating a MySQL database..."
### Use these lines if you need a database for the application. db_name=$(ynh_sanitize_dbid --db_name=$app)
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. db_user=$db_name
### The password will be stored as 'mysqlpwd' into the app settings, ynh_app_setting_set --app=$app --key=db_name --value=$db_name
### and will be available as $db_pwd ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_print_info "Setting up source files..." ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Configuring nginx web server..." ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Configuring system user..."
# Create a system user
ynh_system_user_create $app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_print_info "Configuring php-fpm..." ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config ynh_add_fpm_config
@ -114,85 +99,56 @@ ynh_add_fpm_config
#================================================= #=================================================
# Add cron job # Add cron job
#================================================= #=================================================
ynh_print_info "Configuring a cron task..." ynh_script_progression --message="Configuring a cron task..."
# Path where crontab will be installed
cron_path="/etc/cron.d/$app"
# Copy crontab from package to Yunohost
cp -a ../conf/cheky.cron "$cron_path"
# Secure crontab
chown root: "$cron_path"
chmod 644 "$cron_path"
# Configure crontab
ynh_replace_string "__USER__" "$app" "$cron_path"
ynh_replace_string "__FINALPATH__" "$final_path" "$cron_path"
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#================================================= #=================================================
# SETUP APPLICATION WITH CURL # SETUP APPLICATION WITH CURL
#================================================= #=================================================
# 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_print_info "Configuring SSOwat..." ynh_script_progression --message="Configuring permissions..."
ynh_app_setting_set $app skipped_uris "/" # Making the app public for curl
# Reload SSOwat config ynh_permission_update --permission="main" --add="visitors"
yunohost app ssowatconf
# Reload Nginx # Reload Nginx
systemctl reload nginx systemctl reload nginx
# Installation with curl # Installation with curl
ynh_print_info "Finalizing installation..." ynh_script_progression --message="Finalizing installation..."
# Get database password # Get database password
db_pwd=$(ynh_app_setting_get $app mysqlpwd) db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_local_curl "/index.php?mod=install" "password=$password" "confirmPassword=$password" "type=db" "db[host]=localhost" "db[user]=$db_name" "db[password]=$db_pwd" "db[dbname]=$db_name" ynh_local_curl "/index.php?mod=install" "password=$password" "confirmPassword=$password" "type=db" "db[host]=localhost" "db[user]=$db_name" "db[password]=$db_pwd" "db[dbname]=$db_name"
# Remove the public access # Remove the public access
if [ $is_public -eq 0 ] ynh_permission_update --permission="main" --remove="visitors"
then
ynh_app_setting_delete $app skipped_uris
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R root: $final_path
# Folders that needs to be writable by cheky
chown -R $app: $final_path/var # requirement in official documentation
chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sauvegardées" tab
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_print_info "Configuring SSOwat..." ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway. ynh_permission_update --permission="main" --add="visitors"
ynh_app_setting_set $app unprotected_uris "/"
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info "Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info "Installation of $app completed" ynh_script_progression --message="Installation of $app completed"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get $app final_path)
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
ynh_print_info "Removing the MySQL database" ynh_script_progression --message="Removing the MySQL database"
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_user $db_name ynh_mysql_remove_db $db_user $db_name
@ -34,15 +34,15 @@ ynh_mysql_remove_db $db_user $db_name
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_print_info "Removing app main directory" ynh_script_progression --message="Removing app main directory"
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Removing nginx web server configuration" ynh_script_progression --message="Removing NGINX web server configuration"
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
@ -50,7 +50,7 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_print_info "Removing php-fpm configuration" ynh_script_progression --message="Removing PHP-FPM configuration"
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
ynh_remove_fpm_config ynh_remove_fpm_config
@ -62,23 +62,20 @@ ynh_remove_fpm_config
#================================================= #=================================================
# Remove a cron file # Remove a cron file
ynh_secure_remove "/etc/cron.d/$app" ynh_secure_remove --file="/etc/cron.d/$app"
# Remove the log files
ynh_secure_remove "/var/log/$app/"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_print_info "Removing the dedicated system user" ynh_script_progression --message="Removing the dedicated system user"
# Delete a system user # Delete a system user
ynh_system_user_delete $app ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info "Removal of $app completed" ynh_script_progression --message="Removal of $app completed"

View file

@ -19,19 +19,21 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading settings..." ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_print_info "Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available $domain $path_url \ ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die "Path not available: ${domain}${path_url}"
@ -44,64 +46,62 @@ test ! -d $final_path \
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info "Restoring the app main directory..."
ynh_restore_file "$final_path"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_print_info "Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create $app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=5
# Restore permissions on app files ynh_restore_file --origin_path="$final_path"
chown -R root: $final_path
# Only path that needs to be writable by cheky chmod 750 "$final_path"
chown -R $app: $final_path/var chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
ynh_print_info "Restoring the MySQL database..." ynh_script_progression --message="Restoring the MySQL database..." --weight=1
db_pwd=$(ynh_app_setting_get $app mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#================================================= #=================================================
# RESTORE THE CRON FILE # RESTORE THE CRON FILE
#================================================= #=================================================
ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file "/etc/cron.d/$app" ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_print_info "Reloading nginx web server and php-fpm..." ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
systemctl reload php7.0-fpm ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info "Restoration completed for $app" ynh_script_progression --message="Restoration completed for $app" -last

View file

@ -12,30 +12,41 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading installation settings..." ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get $app path)
admin=$(ynh_app_setting_get $app admin) admin=$(ynh_app_setting_get $app admin)
is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get $app db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
#=================================================
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=1
# 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_print_info "Ensuring downward compatibility..." 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 is_public 1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set $app is_public 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
@ -49,10 +60,17 @@ if [ -z $final_path ]; then
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
fi fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_print_info "Backing up the app before upgrading (may take a while)..." ynh_script_progression --message="Backing up the app before upgrading (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
@ -64,42 +82,43 @@ ynh_clean_setup () {
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# CHECK THE PATH # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Normalize the URL path syntax # Create a dedicated user (if not existing)
path_url=$(ynh_normalize_url_path $path_url) ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_print_info "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src if [ "$upgrade_type" == "UPGRADE_APP" ]
ynh_setup_source "$final_path" then
ynh_script_progression --message="Upgrading source files..." --weight=4
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Upgrading nginx web server configuration..." 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_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create $app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_print_info "Upgrading php-fpm configuration..." ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config ynh_add_fpm_config
@ -107,54 +126,21 @@ ynh_add_fpm_config
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
ynh_print_info "Running specific upgrade..." ynh_script_progression --message="Running specific upgrade..." --weight=1
# Needed so no manual operation has to be done by user while upgrading
# If missing, Cheky is stuck in an "upgrade" state and the config file
# needs to be edited with latest version
# Also avoid to make file "$final_path/version.php" writable
# Give full access to "$app" so php script can do "its own magic stuff"
chown -R $app: $final_path
# Copy Yunohost custom script to cheky folder and launch it # Copy Yunohost custom script to cheky folder and launch it
cp yunohost_upgrade_cheky.php $final_path/others/update/ cp yunohost_upgrade_cheky.php $final_path/others/update/
exec_as "$app" /usr/bin/php $final_path/others/update/yunohost_upgrade_cheky.php $final_path ynh_exec_as "$app" /usr/bin/php$phpversion $final_path/others/update/yunohost_upgrade_cheky.php $final_path
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R root: $final_path
# Folders that needs to be writable by cheky
chown -R $app: $final_path/var # requirement in official documentation
chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sauvegardées" tab
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Upgrading SSOwat configuration..."
# 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 unprotected_uris "/"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_print_info "Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=1
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info "Upgrade of $app completed" ynh_script_progression --message="Upgrade of $app completed" --last