1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/opensondage_ynh.git synced 2024-09-03 19:46:28 +02:00

Merge branch 'testing' into new-permissions-system

This commit is contained in:
Éric Gaspar 2021-07-22 13:50:30 +02:00 committed by GitHub
commit 0a9a11bb57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 164 additions and 297 deletions

View file

@ -1,43 +1,31 @@
<!--
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.
-->
# OpenSondage for YunoHost # OpenSondage for YunoHost
[![Integration level](https://dash.yunohost.org/integration/opensondage.svg)](https://dash.yunohost.org/appci/app/opensondage) ![](https://ci-apps.yunohost.org/ci/badges/opensondage.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/opensondage.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/opensondage.svg)](https://dash.yunohost.org/appci/app/opensondage) ![](https://ci-apps.yunohost.org/ci/badges/opensondage.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/opensondage.maintain.svg)
[![Install OpenSondage with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=opensondage) [![Install OpenSondage with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=opensondage)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install OpenSondage quickly and simply on a YunoHost server. > *This package allows you to install OpenSondage 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
OpenSondage is an online service for planning an appointment or making a decision quickly and easily. It's a community free/libre software alternative to Doodle. Service for planning an appointment or making a decision quickly and easily
**Shipped version:** 1.1.10 **Shipped version:** 1.1.16~ynh1
**Demo:** https://framadate.org/
## Screenshots ## Screenshots
![](https://framadate.org/images/date.png) ![](./doc/screenshots/screenshots.jpg)
## Demo ## Disclaimers / important information
* [YunoHost demo](https://demo.yunohost.org/date/)
* [Official demo](https://framadate.org/)
## Configuration
## Documentation
* Official documentation: https://framagit.org/framasoft/framadate/framadate/wikis/home
* YunoHost documentation: https://yunohost.org/#/app_opensondage
## YunoHost specific features
#### Multi-users support
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/opensondage%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/opensondage/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/opensondage%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/opensondage/)
## Limitations ## Limitations
@ -48,18 +36,18 @@ OpenSondage is an online service for planning an appointment or making a decisio
* This package contains a custom version of Framadate (fork of OpenSondage and Studs), the sources are here: https://git.framasoft.org/framasoft/framadate/. * This package contains a custom version of Framadate (fork of OpenSondage and Studs), the sources are here: https://git.framasoft.org/framasoft/framadate/.
## Links ## Documentation and resources
* Report a bug: https://github.com/YunoHost-Apps/opensondage_ynh/issues * Official app website: https://framadate.org/
* OpenSondage website: https://git.framasoft.org/framasoft/framadate/framadate * Official user documentation: https://yunohost.org/#/app_opensondage
* OpenSondage repository: https://git.framasoft.org/framasoft/framadate/framadate * Official admin documentation: https://framagit.org/framasoft/framadate/framadate/wikis/home
* YunoHost website: https://yunohost.org/ * Upstream app code repository: https://git.framasoft.org/framasoft/framadate
* YunoHost documentation for this app: https://yunohost.org/app_opensondage
* Report a bug: https://github.com/YunoHost-Apps/opensondage_ynh/issues
--- ## Developer info
## Developers info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing).
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` ```
@ -67,3 +55,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/opensondage_ynh/tree/
or or
sudo yunohost app upgrade opensondage -u https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing --debug sudo yunohost app upgrade opensondage -u https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

View file

@ -1,44 +1,27 @@
# OpenSondage pour YunoHost # OpenSondage pour YunoHost
[![Integration level](https://dash.yunohost.org/integration/opensondage.svg)](https://dash.yunohost.org/appci/app/opensondage) ![](https://ci-apps.yunohost.org/ci/badges/opensondage.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/opensondage.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/opensondage.svg)](https://dash.yunohost.org/appci/app/opensondage) ![](https://ci-apps.yunohost.org/ci/badges/opensondage.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/opensondage.maintain.svg)
[![Installer OpenSondage avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=opensondage) [![Installer OpenSondage avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=opensondage)
*[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 OpenSondage rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer OpenSondage rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* 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
OpenSondage est un service en ligne permettant de planifier un rendez-vous ou de prendre une décision rapidement et facilement. C'est une alternative logicielle libre et communautaire à Doodle. Service pour planifier un rendez-vous ou prendre une décision rapidement et facilement
**Version incluse :** 1.1.10 **Version incluse :** 1.1.16~ynh1
**Démo :** https://framadate.org/
## Captures d'écran ## Captures d'écran
![](https://framadate.org/images/date.png) ![](./doc/screenshots/screenshots.jpg)
## Démo ## Avertissements / informations importantes
* [Démo YunoHost](https://demo.yunohost.org/date/)
* [Démo officielle](https://framadate.org/)
## Configuration
## Documentation
* Documentation officielle : https://framagit.org/framasoft/framadate/framadate/wikis/home
* Documentation YunoHost : https://yunohost.org/#/app_opensondage_fr
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateur
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/opensondage%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/opensondage/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/opensondage%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/opensondage/)
## Limitations ## Limitations
@ -49,14 +32,14 @@ OpenSondage est un service en ligne permettant de planifier un rendez-vous ou de
* Ce paquet contient une version personnalisée de Framadate (fork d'OpenSondage et Studs), les sources sont ici : https://git.framasoft.org/framasoft/framadate/. * Ce paquet contient une version personnalisée de Framadate (fork d'OpenSondage et Studs), les sources sont ici : https://git.framasoft.org/framasoft/framadate/.
## Liens ## Documentations et ressources
* Signaler un bug : https://github.com/YunoHost-Apps/opensondage_ynh/issues * Site officiel de l'app : https://framadate.org/
* Site de l'application OpenSondage : https://git.framasoft.org/framasoft/framadate/framadate * Documentation officielle utilisateur : https://yunohost.org/#/app_opensondage
* Dépôt de l'application principale : https://git.framasoft.org/framasoft/framadate/framadate * Documentation officielle de l'admin : https://framagit.org/framasoft/framadate/framadate/wikis/home
* Site web YunoHost : https://yunohost.org/ * Dépôt de code officiel de l'app : https://git.framasoft.org/framasoft/framadate
* Documentation YunoHost pour cette app : https://yunohost.org/app_opensondage
--- * Signaler un bug : https://github.com/YunoHost-Apps/opensondage_ynh/issues
## Informations pour les développeurs ## Informations pour les développeurs
@ -65,6 +48,8 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
``` ```
sudo yunohost app install https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing --debug
or ou
sudo yunohost app upgrade opensondage -u https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing --debug sudo yunohost app upgrade opensondage -u https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,10 +1,10 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) admin="john"
language="fr" language="fr"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -13,15 +13,11 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=eb508660841801995fe2c66e5bf3259cdbea5922 upgrade=1 from_commit=02f2cd7e656ebae74643e969746b23d8912c7798
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1
port_already_use=0
change_url=1 change_url=1
;;; Levels
Level 5=auto
;;; Upgrade options ;;; Upgrade options
; commit=eb508660841801995fe2c66e5bf3259cdbea5922 ; commit=02f2cd7e656ebae74643e969746b23d8912c7798
name=Remove Framasoft signature name=Merge pull request #70 from YunoHost-Apps/testing
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr_FR&is_public=1& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr_FR&is_public=1&

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://framagit.org/framasoft/framadate/framadate/-/archive/1.1.10/framadate-1.1.10.tar.gz SOURCE_URL=https://framagit.org/framasoft/framadate/framadate/-/archive/1.1.16/framadate-1.1.16.tar.gz
SOURCE_SUM=ea9ab8bd713da17dc7e5d6ddd782ce704184a3189888ed837ba8e59ee7b6fa5f SOURCE_SUM=89da42a915c912a91ae1ba44fd32a61ec8fa5f59c517ee3f5d74335ddee77c7d
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=opensondage-1-1-10.tar.gz SOURCE_FILENAME=opensondage-1-1-16.tar.gz

View file

@ -26,19 +26,19 @@ const APP_URL = '__DOMAIN__';
const NOMAPPLICATION = 'OpenSondage'; const NOMAPPLICATION = 'OpenSondage';
// Database administrator email // Database administrator email
const ADRESSEMAILADMIN = '__ADMINMAIL__'; const ADRESSEMAILADMIN = '__EMAIL__';
// Email for automatic responses (you should set it to "no-reply") // Email for automatic responses (you should set it to "no-reply")
const ADRESSEMAILREPONSEAUTO = '<no-reply@__DOMAIN__>'; const ADRESSEMAILREPONSEAUTO = '<no-reply@__DOMAIN__>';
// Database user // Database user
const DB_USER= '__DBUSER__'; const DB_USER= '__DB_USER__';
// Database password // Database password
const DB_PASSWORD = '__DBPWD__'; const DB_PASSWORD = '__DB_PWD__';
// Database server name, leave empty to use a socket // Database server name, leave empty to use a socket
const DB_CONNECTION_STRING = 'mysql:host=localhost;dbname=__DBNAME__;port=3306'; const DB_CONNECTION_STRING = 'mysql:host=localhost;dbname=__DB_NAME__;port=3306';
// Name of the table that store migration script already executed // Name of the table that store migration script already executed
const MIGRATION_TABLE = 'framadate_migration'; const MIGRATION_TABLE = 'framadate_migration';

8
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,8 @@
## Limitations
* There is no way to configure mail, either with smtp or with sendmail. See https://framagit.org/framasoft/framadate/merge_requests/184
* There is no way to use SSOWAT to identify current user. See https://framagit.org/framasoft/framadate/issues/177
## Additional information
* This package contains a custom version of Framadate (fork of OpenSondage and Studs), the sources are here: https://git.framasoft.org/framasoft/framadate/.

8
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,8 @@
## Limitations
* Impossible de configurer le courrier, que ce soit avec smtp ou avec sendmail. Voir https://framagit.org/framasoft/framadate/merge_requests/184
* Impossible d'utiliser SSOWAT pour identifier l'utilisateur actuel. Voir https://framagit.org/framasoft/framadate/issues/177
## Additional information
* Ce paquet contient une version personnalisée de Framadate (fork d'OpenSondage et Studs), les sources sont ici : https://git.framasoft.org/framasoft/framadate/.

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View file

@ -3,12 +3,20 @@
"id": "opensondage", "id": "opensondage",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Service for planning an appointment or making a decision quickly and easily.", "en": "Service for planning an appointment or making a decision quickly and easily",
"fr": "Service pour planifier un rendez-vous ou prendre une décision rapidement et facilement.", "fr": "Service pour planifier un rendez-vous ou prendre une décision rapidement et facilement",
"de": "Service zur schnellen und einfachen Planung eines Termins oder zur Entscheidungsfindung." "de": "Service zur schnellen und einfachen Planung eines Termins oder zur Entscheidungsfindung"
}, },
"version": "1.1.10~ynh2", "version": "1.1.16~ynh1",
"url": "https://git.framasoft.org/framasoft/framadate", "url": "https://git.framasoft.org/framasoft/framadate",
"upstream": {
"license": "CECILL-B",
"website": "https://framadate.org/",
"demo": "https://framadate.org/",
"admindoc": "https://framagit.org/framasoft/framadate/framadate/wikis/home",
"userdoc": "https://yunohost.org/#/app_opensondage",
"code": "https://git.framasoft.org/framasoft/framadate"
},
"license": "CECILL-B", "license": "CECILL-B",
"maintainer": { "maintainer": {
"name": "", "name": "",
@ -19,12 +27,12 @@
"email": "ljf+opensondage_ynh@grimaud.me" "email": "ljf+opensondage_ynh@grimaud.me"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 3.8.1" "yunohost": ">= 4.2.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
@ -32,32 +40,17 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain for OpenSondage",
"fr": "Choisissez un nom de domaine pour OpenSondage",
"de": "Wählen Sie bitte einen Domain für OpenSondage"
},
"example": "domain.org" "example": "domain.org"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for OpenSondage",
"fr": "Choisissez l'adresse pour OpenSondage",
"de": "Tragen Sie bitte den Pfad für OpenSondage ein"
},
"example": "/date", "example": "/date",
"default": "/date" "default": "/date"
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user",
"ask": {
"en": "Choose the OpenSondage administrator (must be an existing YunoHost user)",
"fr": "Choisissez l'administrateur d'OpenSondage (doit être un utilisateur YunoHost)",
"de": "Wählen Sie bitte den OpenSondageadministrator (muss ein vorhandener YunoHost Nutzer sein)"
},
"example": "johndoe" "example": "johndoe"
}, },
{ {
@ -68,17 +61,12 @@
"fr": "Choisissez la langue par défault d'OpenSondage", "fr": "Choisissez la langue par défault d'OpenSondage",
"de": "Wählen Sie bitte die Standardsprache für OpenSondage." "de": "Wählen Sie bitte die Standardsprache für OpenSondage."
}, },
"choices": ["fr","en", "oc", "es", "de", "nl", "it", "br"], "choices": ["br", "de", "en", "es", "fr", "it", "nl", "oc"],
"default": "en" "default": "en"
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Can non-members create a poll?",
"fr": "Une personne non membre peut elle créer un sondage ?",
"de": "Kann einen nicht eingeloggter Nutzer einen Umfrage erstellen?"
},
"default": true "default": true
} }
] ]

View file

@ -6,8 +6,8 @@
# dependencies used by the app # dependencies used by the app
YNH_PHP_VERSION="7.3" YNH_PHP_VERSION="7.3"
YNH_COMPOSER_VERSION=2.1.1
pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli" extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
@ -20,63 +20,3 @@ pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php$
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}
# Execute a command with Composer
#
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands"
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
# Declare an array to define the options of this helper.
local legacy_args=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path]
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vw
declare -Ar args_array=( [v]=phpversion= [w]=workdir= )
local phpversion
local workdir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" \
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \
|| ynh_die "Unable to update core dependencies with Composer."
}

View file

@ -24,13 +24,15 @@ path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
language=$YNH_APP_ARG_LANGUAGE language=$YNH_APP_ARG_LANGUAGE
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
email=$(ynh_user_get_info --username=$admin --key=mail)
timezone="$(cat /etc/timezone)"
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_script_progression --message="Validating installation parameters..." ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -47,16 +49,15 @@ 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=language --value=$language ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=email --value=$email
#================================================= #=================================================
# STANDARD MODIFICATIONS # CREATE DEDICATED USER
#================================================= #=================================================
# INSTALL DEPENDENCIES ynh_script_progression --message="Configuring system user..." --weight=2
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=3
ynh_install_app_dependencies $pkg_dependencies # Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
@ -64,6 +65,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Creating a MySQL database..." --weight=2 ynh_script_progression --message="Creating a MySQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name
@ -76,6 +78,10 @@ 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 --dest_dir="$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
#================================================= #=================================================
@ -84,21 +90,14 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# 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="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..." --weight=2 ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -107,25 +106,7 @@ ynh_add_fpm_config
#================================================= #=================================================
ynh_script_progression --message="Configuring $app..." --weight=2 ynh_script_progression --message="Configuring $app..." --weight=2
config="$final_path/app/inc/config.php" ynh_add_config --template="../conf/config.php" --destination="$final_path/app/inc/config.php"
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
cp ../conf/config.php "$config"
# Change variables in configuration
ynh_replace_string --match_string="__DBUSER__" --replace_string=$db_name --target_file="$config"
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="__DBNAME__" --replace_string=$db_name --target_file="$config"
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string=$admin_mail --target_file="$config"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string=$language --target_file="$config"
ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$config"
ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$config"
timezone="$(cat /etc/timezone)"
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$timezone --target_file="$config"
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
#================================================= #=================================================
# SETUP HOOKS FILE # SETUP HOOKS FILE
@ -155,7 +136,7 @@ ynh_script_progression --message="Initializing database..." --weight=2
# Install composer # Install composer
ynh_install_composer ynh_install_composer
ynh_exec_warn_less php$YNH_PHP_VERSION "$final_path/admin/migration.php" ynh_exec_warn_less php$phpversion "$final_path/admin/migration.php"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -163,7 +144,6 @@ ynh_exec_warn_less php$YNH_PHP_VERSION "$final_path/admin/migration.php"
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
chown -R root: "$final_path"
chown -R $app: "$final_path/"{tpl_c,admin/stdout.log} chown -R $app: "$final_path/"{tpl_c,admin/stdout.log}
#================================================= #=================================================

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -20,16 +20,6 @@ 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)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=3
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
@ -67,7 +57,7 @@ ynh_remove_fpm_config
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username=$app

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." --weight=2 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -28,11 +28,12 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
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) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
timezone="$(cat /etc/timezone)"
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================ #================================================
ynh_script_progression --message="Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
@ -44,23 +45,28 @@ test ! -d $final_path \
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# 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 --home_dir=$final_path
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
@ -72,9 +78,12 @@ chown -R $app: "$final_path/"{tpl_c,admin/stdout.log}
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=5
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --package="$extra_php_dependencies"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
@ -84,16 +93,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=9
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -23,7 +23,11 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public)
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)
db_name=$(ynh_app_setting_get --app=$app --key=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) phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
email=$(ynh_app_setting_get --app=$app --key=email)
timezone="$(cat /etc/timezone)"
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -34,10 +38,9 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if [ -z "$is_public" ] if [ -z "$is_public" ]; then
then
is_public=$(ynh_app_setting_get --app=$app --key=public_site) is_public=$(ynh_app_setting_get --app=$app --key=public_site)
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_delete --app=$app --key=public_site ynh_app_setting_delete --app=$app --key=public_site
@ -101,15 +104,18 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
# If email doesn't exist, create it
if [ -z "$email" ]; then
email=$(ynh_user_get_info --username=$admin --key=mail)
fi
# Make sure default language is set # Make sure default language is set
if [ -z "$language" ] if [ -z "$language" ]; then
then language=en
language=$(grep LANGUE "/var/www/$app/variables.php" | grep -Po "'.*?'" | cut -d"'" -f2)
fi fi
# Use path instead of path_url in settings.yml... # Use path instead of path_url in settings.yml...
if [ -z "$path_url" ] if [ -z "$path_url" ]; then
then
path_url=$(ynh_app_setting_get --app=$app --key=path_url) path_url=$(ynh_app_setting_get --app=$app --key=path_url)
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_delete --app=$app --key=path_url ynh_app_setting_delete --app=$app --key=path_url
@ -129,6 +135,14 @@ 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
#=================================================
# 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 --home_dir="$final_path"
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -143,6 +157,10 @@ then
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
fi fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -151,28 +169,13 @@ 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
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=7
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# 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=3 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 --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -184,28 +187,9 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Reconfiguring $app..." --weight=2 ynh_script_progression --message="Reconfiguring $app..." --weight=2
config="$final_path/app/inc/config.php" ynh_add_config --template="../conf/config.php" --destination="$final_path/app/inc/config.php"
chmod 400 "$final_path/app/inc/config.php"
# Verify the checksum and backup the file if it's different chown $app:$app "$final_path/app/inc/config.php"
ynh_backup_if_checksum_is_different --file="$config"
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
cp ../conf/config.php "$config"
# Change variables in configuration
ynh_replace_string --match_string="__DBUSER__" --replace_string=$db_name --target_file="$config"
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="__DBNAME__" --replace_string=$db_name --target_file="$config"
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string=$admin_mail --target_file="$config"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string=$language --target_file="$config"
ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$config"
ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$config"
timezone="$(cat /etc/timezone)"
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$timezone --target_file="$config"
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
fi fi
#================================================= #=================================================
@ -238,7 +222,7 @@ then
# Install composer # Install composer
ynh_install_composer ynh_install_composer
ynh_exec_warn_less php "$final_path/admin/migration.php" ynh_exec_warn_less php$phpversion "$final_path/admin/migration.php"
fi fi
#================================================= #=================================================
@ -247,13 +231,12 @@ fi
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
chown -R root: "$final_path"
chown -R $app: "$final_path/"{tpl_c,admin/stdout.log} chown -R $app: "$final_path/"{tpl_c,admin/stdout.log}
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload