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

Merge pull request #77 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2021-08-09 20:51:24 +02:00 committed by GitHub
commit 61398d8e49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 217 additions and 353 deletions

View file

@ -6,11 +6,11 @@ about: When creating a bug report, please use the following template to provide
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Make sure you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *In doubt, ask here and we will figure it out together.*
3. *Delete these italic comments as you write over them below, and remove this guide.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
@ -25,13 +25,13 @@ about: When creating a bug report, please use the following template to provide
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info opensondage`*
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install opensondage
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

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
[![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)*
> *This package allow 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.*
> *This package allows you to install OpenSondage 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
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
![](https://framadate.org/images/date.png)
![](./doc/screenshots/screenshots.jpg)
## Demo
* [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/)
## Disclaimers / important information
## 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/.
## Links
## Documentation and resources
* Report a bug: https://github.com/YunoHost-Apps/opensondage_ynh/issues
* OpenSondage website: https://git.framasoft.org/framasoft/framadate/framadate
* OpenSondage repository: https://git.framasoft.org/framasoft/framadate/framadate
* YunoHost website: https://yunohost.org/
* Official app website: https://framadate.org/
* Official user documentation: https://yunohost.org/#/app_opensondage
* Official admin documentation: https://framagit.org/framasoft/framadate/framadate/wikis/home
* 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 do your pull request to the [testing branch](https://github.com/YunoHost-Apps/opensondage_ynh/tree/testing).
Please send 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.
```
@ -67,3 +55,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/opensondage_ynh/tree/
or
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
[![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)
[![Installer OpenSondage avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=opensondage)
[![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.svg)](https://install-app.yunohost.org/?app=opensondage)
*[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.
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
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
![](https://framadate.org/images/date.png)
![](./doc/screenshots/screenshots.jpg)
## Démo
* [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/)
## Avertissements / informations importantes
## 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/.
## Liens
## Documentations et ressources
* Signaler un bug : https://github.com/YunoHost-Apps/opensondage_ynh/issues
* Site de l'application OpenSondage : https://git.framasoft.org/framasoft/framadate/framadate
* Dépôt de l'application principale : https://git.framasoft.org/framasoft/framadate/framadate
* Site web YunoHost : https://yunohost.org/
---
* Site officiel de l'app : https://framadate.org/
* Documentation officielle utilisateur : https://yunohost.org/#/app_opensondage
* Documentation officielle de l'admin : https://framagit.org/framasoft/framadate/framadate/wikis/home
* 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
@ -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.
```
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
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,10 +1,10 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
domain="domain.tld"
path="/path"
admin="john"
language="fr"
is_public=1 (PUBLIC|public=1|private=0)
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1
@ -13,15 +13,11 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=eb508660841801995fe2c66e5bf3259cdbea5922
upgrade=1 from_commit=02f2cd7e656ebae74643e969746b23d8912c7798
backup_restore=1
multi_instance=1
incorrect_path=1
port_already_use=0
change_url=1
;;; Levels
Level 5=auto
;;; Upgrade options
; commit=eb508660841801995fe2c66e5bf3259cdbea5922
name=Remove Framasoft signature
; commit=02f2cd7e656ebae74643e969746b23d8912c7798
name=Merge pull request #70 from YunoHost-Apps/testing
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_SUM=ea9ab8bd713da17dc7e5d6ddd782ce704184a3189888ed837ba8e59ee7b6fa5f
SOURCE_URL=https://framagit.org/framasoft/framadate/framadate/-/archive/1.1.16/framadate-1.1.16.tar.gz
SOURCE_SUM=89da42a915c912a91ae1ba44fd32a61ec8fa5f59c517ee3f5d74335ddee77c7d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
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';
// Database administrator email
const ADRESSEMAILADMIN = '__ADMINMAIL__';
const ADRESSEMAILADMIN = '__EMAIL__';
// Email for automatic responses (you should set it to "no-reply")
const ADRESSEMAILREPONSEAUTO = '<no-reply@__DOMAIN__>';
// Database user
const DB_USER= '__DBUSER__';
const DB_USER= '__DB_USER__';
// Database password
const DB_PASSWORD = '__DBPWD__';
const DB_PASSWORD = '__DB_PWD__';
// 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
const MIGRATION_TABLE = 'framadate_migration';

View file

@ -1,30 +1,39 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source
alias __FINALPATH__/;
# Path to source
alias __FINALPATH__/;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.php;
try_files $uri $uri/ /index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param HTTPS on;
}
rewrite "^__PATH__/([a-zA-Z0-9-]+)$" "__PATH__/studs.php?poll=$1";
rewrite "^__PATH__/([a-zA-Z0-9-]+)/action/([a-zA-Z_-]+)/(.+)$" "__PATH__/studs.php?poll=$1&$2=$3";
rewrite "^__PATH__/([a-zA-Z0-9-]+)/vote/([a-zA-Z0-9]{16})$" "__PATH__/studs.php?poll=$1&vote=$2";
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
# Admin requires the private poll ID, 24-char long
rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin$" "__PATH__/adminstuds.php?poll=$1";
rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin/vote/([a-zA-Z0-9]{16})$" "__PATH__/adminstuds.php?poll=$1&vote=$2";
rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin/action/([a-zA-Z_-]+)(/(.+))?$" "__PATH__/adminstuds.php?poll=$1&$2=$4";
index index.php;
try_files $uri $uri/ /index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param HTTPS on;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}
location ~ ^__PATH__/(data|config|\.ht|db_structure\.xml|README) {
deny all;
deny all;
}

View file

@ -431,3 +431,6 @@ chdir = __FINALPATH__
php_admin_value[upload_max_filesize] = 10G
php_admin_value[post_max_size] = 10G
php_admin_value[session.cookie_httponly] = 1
php_admin_value[date.timezone] = __TIMEZONE__

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",
"packaging_format": 1,
"description": {
"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.",
"de": "Service zur schnellen und einfachen Planung eines Termins oder zur Entscheidungsfindung."
"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",
"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",
"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",
"maintainer": {
"name": "",
@ -19,12 +27,12 @@
"email": "ljf+opensondage_ynh@grimaud.me"
}],
"requirements": {
"yunohost": ">= 3.8.1"
"yunohost": ">= 4.2.0"
},
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm",
"php7.3-fpm",
"mysql"
],
"arguments": {
@ -32,32 +40,17 @@
{
"name": "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"
},
{
"name": "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",
"default": "/date"
},
{
"name": "admin",
"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"
},
{
@ -68,17 +61,12 @@
"fr": "Choisissez la langue par défault d'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"
},
{
"name": "is_public",
"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
}
]

View file

@ -1,18 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/opensondage_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/opensondage_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -6,8 +6,8 @@
# dependencies used by the app
YNH_PHP_VERSION="7.3"
pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli"
YNH_COMPOSER_VERSION=2.1.1
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
@ -20,63 +20,3 @@ pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php$
#=================================================
# 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
language=$YNH_APP_ARG_LANGUAGE
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
#=================================================
# 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
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=admin --value=$admin
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="Installing dependencies..." --weight=3
ynh_script_progression --message="Configuring system user..." --weight=2
ynh_install_app_dependencies $pkg_dependencies
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# CREATE A MYSQL DATABASE
@ -64,6 +65,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Creating a MySQL database..." --weight=2
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_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
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
#=================================================
@ -84,21 +90,14 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated 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
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# 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
@ -107,23 +106,7 @@ ynh_add_fpm_config
#=================================================
ynh_script_progression --message="Configuring $app..." --weight=2
config="$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"
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
ynh_add_config --template="../conf/config.php" --destination="$final_path/app/inc/config.php"
#=================================================
# REPLACE LOGO IMAGE (DEFAULT IS FRAMADATE)
@ -145,7 +128,7 @@ ynh_script_progression --message="Initializing database..." --weight=2
# 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
@ -153,18 +136,17 @@ ynh_exec_warn_less php$YNH_PHP_VERSION "$final_path/admin/migration.php"
# SECURE FILES AND DIRECTORIES
#=================================================
chown -R root: "$final_path"
chown -R $app: "$final_path/"{tpl_c,admin/stdout.log}
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
ynh_permission_update --permission="main" --add="visitors"
# Keep /admin private
if [ "$path_url" == "/" ]; then

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
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
#=================================================
@ -67,7 +57,7 @@ ynh_remove_fpm_config
#=================================================
# 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
ynh_system_user_delete --username=$app

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=2
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
timezone="$(cat /etc/timezone)"
#=================================================
# 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_die --message="Path not available: ${domain}${path_url}"
@ -44,23 +45,28 @@ test ! -d $final_path \
#=================================================
# 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"
#=================================================
# 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
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# 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
@ -72,9 +78,12 @@ chown -R $app: "$final_path/"{tpl_c,admin/stdout.log}
#=================================================
# 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_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# 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_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
#=================================================

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)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
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
@ -34,24 +38,14 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if [ -z "$is_public" ]
then
if [ -z "$is_public" ]; then
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_delete --app=$app --key=public_site
fi
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
@ -64,15 +58,18 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
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
if [ -z "$language" ]
then
language=$(grep LANGUE "/var/www/$app/variables.php" | grep -Po "'.*?'" | cut -d"'" -f2)
if [ -z "$language" ]; then
language=en
fi
# Use path instead of path_url in settings.yml...
if [ -z "$path_url" ]
then
if [ -z "$path_url" ]; then
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_delete --app=$app --key=path_url
@ -93,11 +90,12 @@ ynh_clean_setup () {
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
path_url=$(ynh_normalize_url_path --path_url=$path_url)
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
@ -113,6 +111,10 @@ then
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
#=================================================
@ -121,28 +123,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated 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
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# SPECIFIC UPGRADE
@ -154,27 +141,9 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Reconfiguring $app..." --weight=2
config="$final_path/app/inc/config.php"
# Verify the checksum and backup the file if it's different
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"
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
ynh_add_config --template="../conf/config.php" --destination="$final_path/app/inc/config.php"
chmod 400 "$final_path/app/inc/config.php"
chown $app:$app "$final_path/app/inc/config.php"
fi
#=================================================
@ -200,7 +169,7 @@ then
# 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
#=================================================
@ -209,13 +178,12 @@ fi
# SECURE FILES AND DIRECTORIES
#=================================================
chown -R root: "$final_path"
chown -R $app: "$final_path/"{tpl_c,admin/stdout.log}
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..."
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -235,7 +203,7 @@ fi
#=================================================
# 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