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

Merge pull request #59 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
yalh76 2022-08-15 15:42:28 +02:00 committed by GitHub
commit 89627ef4fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 221 additions and 189 deletions

View file

@ -1,70 +1,48 @@
<!--
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.
-->
# Framaforms for YunoHost # Framaforms for YunoHost
[![Integration level](https://dash.yunohost.org/integration/framaforms.svg)](https://dash.yunohost.org/appci/app/framaforms) ![](https://ci-apps.yunohost.org/ci/badges/framaforms.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/framaforms.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/framaforms.svg)](https://dash.yunohost.org/appci/app/framaforms) ![Working status](https://ci-apps.yunohost.org/ci/badges/framaforms.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/framaforms.maintain.svg)
[![Install Framaforms with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=framaforms) [![Install Framaforms with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=framaforms)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Framaforms quickly and simply on a YunoHost server. > *This package allows you to install Framaforms 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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
Framaforms is an online forms and surveys service. Registered users are allowed to create forms, share them, collect and visualize results through a simple interface. Framaforms is an online forms and surveys service. Registered users are allowed to create forms, share them, collect and visualize results through a simple interface.
See this [article](https://framablog.org/2016/10/05/framaforms-noffrez-plus-les-reponses-que-vous-collectez-a-google/) and this [interview](https://framablog.org/2016/10/05/en-savoir-un-peu-plus-sur-le-projet-framaforms/) (in French) for further informations. See this [article](https://framablog.org/2016/10/05/framaforms-noffrez-plus-les-reponses-que-vous-collectez-a-google/) and this [interview](https://framablog.org/2016/10/05/en-savoir-un-peu-plus-sur-le-projet-framaforms/) (in French) for further informations.
**Shipped version:** 1.0.3
## Screenshot **Shipped version:** 1.0.3~ynh3
## Disclaimers / important information
![Animation that present how to build a form with Framaforms](https://framaforms.org/profiles/framaforms_org/files/imgforms/anim_creation.gif)
## Demo
* [Official demo](https://framaforms.org/)
## Configuration ## Configuration
You can modify some configurations using the Framaforms administration panel. You can log in with the admin user and the password you gave during installation. You can modify some configurations using the Framaforms administration panel. You can log in with the admin user and the password you gave during installation.
## Documentation ## Documentation and resources
* Official documentation: https://docs.framasoft.org/fr/framaforms/ * Official app website: <https://framaforms.org>
* YunoHost documentation: https://yunohost.org/en/app_framaforms * Upstream app code repository: <https://framagit.org/framasoft/framaforms>
* YunoHost documentation for this app: <https://yunohost.org/app_framaforms>
## YunoHost specific features * Report a bug: <https://github.com/YunoHost-Apps/framaforms_ynh/issues>
#### Multi-user support
* Are LDAP and HTTP auth supported? **Only LDAP**
* Can the app be used by multiple users? **Yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/framaforms%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/framaforms/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/framaforms%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/framaforms/)
## Limitations
* Any known limitations.
## Additional information
* Other info you would like to add about this app.
## Links
* Report a bug: https://github.com/YunoHost-Apps/framaforms_ynh/issues
* App website: https://framaforms.org/
* Upstream app repository: https://framagit.org/framasoft/framaforms
* YunoHost website: https://yunohost.org/
---
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing --debug
or or
sudo yunohost app upgrade framaforms -u https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing --debug sudo yunohost app upgrade framaforms -u https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

48
README_fr.md Normal file
View file

@ -0,0 +1,48 @@
<!--
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.
-->
# Framaforms pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/framaforms.svg)](https://dash.yunohost.org/appci/app/framaforms) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/framaforms.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/framaforms.maintain.svg)
[![Installer Framaforms avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=framaforms)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Framaforms 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
Framaforms is an online forms and surveys service. Registered users are allowed to create forms, share them, collect and visualize results through a simple interface.
See this [article](https://framablog.org/2016/10/05/framaforms-noffrez-plus-les-reponses-que-vous-collectez-a-google/) and this [interview](https://framablog.org/2016/10/05/en-savoir-un-peu-plus-sur-le-projet-framaforms/) (in French) for further informations.
**Version incluse :** 1.0.3~ynh3
## Avertissements / informations importantes
## Configuration
You can modify some configurations using the Framaforms administration panel. You can log in with the admin user and the password you gave during installation.
## Documentations et ressources
* Site officiel de l'app : <https://framaforms.org>
* Dépôt de code officiel de l'app : <https://framagit.org/framasoft/framaforms>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_framaforms>
* Signaler un bug : <https://github.com/YunoHost-Apps/framaforms_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing --debug
ou
sudo yunohost app upgrade framaforms -u https://github.com/YunoHost-Apps/framaforms_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -2,9 +2,9 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john"
language="fr"
is_public=1 is_public=1
language="fr"
admin="john"
password="password" password="password"
expiration="0" expiration="0"
deletion="0" deletion="0"
@ -16,8 +16,11 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 1.0.3~ynh3
upgrade=1 from_commit=79cdc1a139ff06805647cb56e5eab1d595ee0259
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email=ljf+framaforms_ynh@reflexlibre.net Email=ljf+framaforms_ynh@reflexlibre.net

0
doc/.gitkeep Normal file
View file

2
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,2 @@
Framaforms is an online forms and surveys service. Registered users are allowed to create forms, share them, collect and visualize results through a simple interface.
See this [article](https://framablog.org/2016/10/05/framaforms-noffrez-plus-les-reponses-que-vous-collectez-a-google/) and this [interview](https://framablog.org/2016/10/05/en-savoir-un-peu-plus-sur-le-projet-framaforms/) (in French) for further informations.

3
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,3 @@
## Configuration
You can modify some configurations using the Framaforms administration panel. You can log in with the admin user and the password you gave during installation.

0
doc/screenshots/.gitkeep Normal file
View file

View file

@ -7,16 +7,21 @@
"fr": "Créez des formulaires et questionnaires en ligne" "fr": "Créez des formulaires et questionnaires en ligne"
}, },
"version": "1.0.3~ynh3", "version": "1.0.3~ynh3",
"url": "https://framagit.org/framasoft/framaforms", "url": "https://framaforms.org",
"upstream": {
"license": "GPL-2.0-only", "license": "GPL-2.0-only",
"requirements": { "website": "https://framaforms.org",
"yunohost": ">= 4.3.0" "code": "https://framagit.org/framasoft/framaforms"
}, },
"license": "GPL-2.0-only",
"maintainer": { "maintainer": {
"name": "ljf", "name": "ljf",
"email": "ljf+framaforms_ynh@reflexlibre.net", "email": "ljf+framaforms_ynh@reflexlibre.net",
"url": "https://reflexlibre.net" "url": "https://reflexlibre.net"
}, },
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
@ -24,7 +29,7 @@
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain" "type": "domain"
@ -36,12 +41,13 @@
"default": "/poll" "default": "/poll"
}, },
{ {
"name": "admin", "name": "is_public",
"type": "user" "type": "boolean",
"help": {
"en": "If no, only person with an account on your server will be able to create forms. In all cases, visitors will be able to reply to form.",
"fr": "Si non, seule la personne disposant d'un compte sur votre serveur pourra créer des formulaires. Dans tous les cas, les visiteurs pourront répondre au formulaire."
}, },
{ "default": true
"name": "password",
"type": "password"
}, },
{ {
"name": "language", "name": "language",
@ -53,6 +59,14 @@
"choices": ["de", "en", "es", "fr", "it", "pt"], "choices": ["de", "en", "es", "fr", "it", "pt"],
"default": "en" "default": "en"
}, },
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "password"
},
{ {
"name": "expiration", "name": "expiration",
"type": "string", "type": "string",
@ -78,15 +92,6 @@
"fr": "Mettre 0 pour désactiver la suppression" "fr": "Mettre 0 pour désactiver la suppression"
}, },
"default": "0" "default": "0"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If no, only person with an account on your server will be able to create forms. In all cases, visitors will be able to reply to form.",
"fr": "Si non, seule la personne disposant d'un compte sur votre serveur pourra créer des formulaires. Dans tous les cas, les visiteurs pourront répondre au formulaire."
},
"default": true
} }
] ]
} }

View file

@ -62,7 +62,7 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP A CRON FILE # BACKUP VARIOUS FILES
#================================================= #=================================================
ynh_backup --src_path="/etc/cron.d/$app" ynh_backup --src_path="/etc/cron.d/$app"

View file

@ -22,16 +22,17 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD
expiration=$YNH_APP_ARG_EXPIRATION expiration=$YNH_APP_ARG_EXPIRATION
deletion=$YNH_APP_ARG_DELETION deletion=$YNH_APP_ARG_DELETION
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -50,9 +51,9 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=language --value=$language
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=password --value=$password ynh_app_setting_set --app=$app --key=password --value=$password
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=expiration --value=$expiration ynh_app_setting_set --app=$app --key=expiration --value=$expiration
ynh_app_setting_set --app=$app --key=deletion --value=$deletion ynh_app_setting_set --app=$app --key=deletion --value=$deletion
@ -98,14 +99,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -115,6 +108,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
ynh_add_fpm_config --usage=low --footprint=low ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
@ -165,21 +166,11 @@ datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir mkdir -p $datadir
chmod 750 "$datadir" chmod 750 "$datadir"
chmod -R o-rwx "$datadir" chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir" chown -R $app:www-data "$datadir"
#=================================================
# ADD MISSING IMAGES
#=================================================
#ynh_script_progression --message="Adding missing images..." --weight=2
#
#mkdir -p "$final_path/sites/default/files/imgforms"
#
#cp ../sources/anim_analyse.gif "$final_path/sites/default/files/imgforms/"
#cp ../sources/anim_creation.gif "$final_path/sites/default/files/imgforms/"
#cp ../sources/partager.png "$final_path/sites/default/files/imgforms/"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
@ -196,54 +187,54 @@ chown $app:$app "$final_path/app/sites/default/settings.php"
ynh_script_progression --message="Installing database..." --weight=19 ynh_script_progression --message="Installing database..." --weight=19
update-alternatives --set php /usr/bin/php$phpversion update-alternatives --set php /usr/bin/php$phpversion
sudo -u $app env PATH=$PATH drush @$app site-install framaforms_org install_configure_form.site_contact_url="https://forum.yunohost.org/t/framaforms-create-polls-using-drag-and-drop/8208" install_configure_form.site_default_country=FR -y --locale="$language" --account-name="admin" --account-pass="$password" --site-name="Framaforms" --site-mail="$admin_mail" 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app site-install framaforms_org install_configure_form.site_contact_url="https://forum.yunohost.org/t/framaforms-create-polls-using-drag-and-drop/8208" install_configure_form.site_default_country=FR -y --locale="$language" --account-name="admin" --account-pass="$password" --site-name="Framaforms" --site-mail="$admin_mail" 2>&1
sudo -u $app env PATH=$PATH drush @$app variable-set update_notify_emails "$admin_mail" ynh_exec_as $app env PATH=$PATH drush @$app variable-set update_notify_emails "$admin_mail"
sudo -u $app env PATH=$PATH drush @$app variable-set file_private_path "/home/yunohost.app/$app/data" 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app variable-set file_private_path "/home/yunohost.app/$app/data" 2>&1
sudo -u $app env PATH=$PATH drush @$app pm-enable framaforms_feature -y --resolve-dependencies 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app pm-enable framaforms_feature -y --resolve-dependencies 2>&1
sudo -u $app env PATH=$PATH drush @$app php-eval "module_load_include('inc', 'framaforms', 'includes/framaforms.pages');create_all_pages();" 2>&1 || true ynh_exec_as $app env PATH=$PATH drush @$app php-eval "module_load_include('inc', 'framaforms', 'includes/framaforms.pages');create_all_pages();" 2>&1 || true
#================================================= #=================================================
# IMPORTING LANGUAGE PACK # IMPORTING LANGUAGE PACK
#================================================= #=================================================
ynh_script_progression --message="Importing language pack..." --weight=5 ynh_script_progression --message="Importing language pack..." --weight=5
sudo -u $app env PATH=$PATH drush @$app pm-download -y drush_language 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app pm-download -y drush_language 2>&1
sudo -u $app env PATH=$PATH drush @$app pm-download -y l10n_update 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app pm-download -y l10n_update 2>&1
sudo -u $app env PATH=$PATH drush @$app pm-enable -y l10n_update 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app pm-enable -y l10n_update 2>&1
sudo -u $app env PATH=$PATH drush @$app language-add $language -y 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app language-add $language -y 2>&1
sudo -u $app env PATH=$PATH drush @$app language-default $language -y 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app language-default $language -y 2>&1
sudo -u $app env PATH=$PATH drush @$app cache-clear drush -y 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app cache-clear drush -y 2>&1
sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh -y 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app l10n-update-refresh -y 2>&1
sudo -u $app env PATH=$PATH drush @$app l10n-update -y 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app l10n-update -y 2>&1
# We don't upgrade module to avoid to erase framaforms change # We don't upgrade module to avoid to erase framaforms change
# in drupal core and modules code # in drupal core and modules code
# see https://framagit.org/framasoft/framaforms/-/wikis/modifications # see https://framagit.org/framasoft/framaforms/-/wikis/modifications
#sudo -u $app env PATH=$PATH drush @$app pm-update -y #ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y
#================================================= #=================================================
# REMOVING BRANDING AND CHANGING DEFAULT SETTINGS # REMOVING BRANDING AND CHANGING DEFAULT SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Removing branding and change default settings..." --weight=1 ynh_script_progression --message="Removing branding and change default settings..." --weight=1
sudo -u $app env PATH=$PATH drush @$app vset error_level 0 ynh_exec_as $app env PATH=$PATH drush @$app vset error_level 0
sudo -u $app env PATH=$PATH drush @$app vset framaforms_notification_period_value $expiration ynh_exec_as $app env PATH=$PATH drush @$app vset framaforms_notification_period_value $expiration
sudo -u $app env PATH=$PATH drush @$app vset framaforms_deletion_period_value $deletion ynh_exec_as $app env PATH=$PATH drush @$app vset framaforms_deletion_period_value $deletion
# Remove framaforms footer # Remove framaforms footer
sudo -u $app env PATH=$PATH drush @$app sql-query "UPDATE block SET region='-1', status=0 WHERE delta='framaforms_footer' AND region='footer'" ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE block SET region='-1', status=0 WHERE delta='framaforms_footer' AND region='footer'"
#================================================= #=================================================
# CONFIGURING LDAP # CONFIGURING LDAP
#================================================= #=================================================
ynh_script_progression --message="Configuring LDAP authentication..." --weight=1 ynh_script_progression --message="Configuring LDAP authentication..." --weight=1
sudo -u $app env PATH=$PATH drush @$app pm-download ldap ynh_exec_as $app env PATH=$PATH drush @$app pm-download ldap
sudo -u $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role ynh_exec_as $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role
# Generated with sudo -u postgres pg_dump -a -t ldap_servers --inserts framaforms # Generated with sudo -u postgres pg_dump -a -t ldap_servers --inserts framaforms
sudo -u $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_servers VALUES ('localhost', 1, 'localhost', 1, 'default', 'ldap://127.0.0.1', 389, 0, 0, 3, '', NULL, 'a:2:{i:0;s:27:\"ou=users,dc=yunohost,dc=org\";i:1;s:32:\"ou=permission,dc=yunohost,dc=org\";}', 'uid', 'uid', 'mail', '', '', '', 0, 'cn=%username,ou=users,dc=yunohost,dc=org', '', '', '', 0, 'permissionynh', 0, 1, 'permission', 'memberuid', 'dn', 0, '', '$app.main', '', 0, 1000, 0);" ynh_exec_as $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_servers VALUES ('localhost', 1, 'localhost', 1, 'default', 'ldap://127.0.0.1', 389, 0, 0, 3, '', NULL, 'a:2:{i:0;s:27:\"ou=users,dc=yunohost,dc=org\";i:1;s:32:\"ou=permission,dc=yunohost,dc=org\";}', 'uid', 'uid', 'mail', '', '', '', 0, 'cn=%username,ou=users,dc=yunohost,dc=org', '', '', '', 0, 'permissionynh', 0, 1, 'permission', 'memberuid', 'dn', 0, '', '$app.main', '', 0, 1000, 0);"
sudo -u $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_authorization VALUES (1, 'localhost', 'drupal_role', 'ldap_authorization_drupal_role', 1, 1, 0, 'a:2:{i:0;a:6:{s:12:\"user_entered\";s:24:\"utilisateur authentifié\";s:4:\"from\";s:51:\"cn=framaforms.main,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:24:\"utilisateur authentifié\";s:10:\"simplified\";s:24:\"utilisateur authentifié\";s:5:\"valid\";b:0;s:13:\"error_message\";s:112:\"Role <em class=\"placeholder\">utilisateur authentifié</em>_name does not exist and role creation is not enabled.\";}i:1;a:6:{s:12:\"user_entered\";s:13:\"administrator\";s:4:\"from\";s:52:\"cn=framaforms.admin,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:13:\"administrator\";s:10:\"simplified\";s:13:\"administrator\";s:5:\"valid\";b:0;s:13:\"error_message\";s:101:\"Role <em class=\"placeholder\">administrator</em>_name does not exist and role creation is not enabled.\";}}', 1, 0, 1, 1, 1, 1);" ynh_exec_as $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_authorization VALUES (1, 'localhost', 'drupal_role', 'ldap_authorization_drupal_role', 1, 1, 0, 'a:2:{i:0;a:6:{s:12:\"user_entered\";s:24:\"utilisateur authentifié\";s:4:\"from\";s:51:\"cn=framaforms.main,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:24:\"utilisateur authentifié\";s:10:\"simplified\";s:24:\"utilisateur authentifié\";s:5:\"valid\";b:0;s:13:\"error_message\";s:112:\"Role <em class=\"placeholder\">utilisateur authentifié</em>_name does not exist and role creation is not enabled.\";}i:1;a:6:{s:12:\"user_entered\";s:13:\"administrator\";s:4:\"from\";s:52:\"cn=framaforms.admin,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:13:\"administrator\";s:10:\"simplified\";s:13:\"administrator\";s:5:\"valid\";b:0;s:13:\"error_message\";s:101:\"Role <em class=\"placeholder\">administrator</em>_name does not exist and role creation is not enabled.\";}}', 1, 0, 1, 1, 1, 1);"
cat ../conf/ldap.conf | sudo -u $app env PATH=$PATH drush @$app variable-set --format=yaml ldap_authentication_conf - cat ../conf/ldap.conf | ynh_exec_as $app env PATH=$PATH drush @$app variable-set --format=yaml ldap_authentication_conf -
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}

View file

@ -27,18 +27,10 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# REMOVE THE POSTGRESQL DATABASE # REMOVE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Removing the database..." --weight=1 ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=7
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
@ -48,6 +40,17 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
ynh_secure_remove --file="$datadir"
fi
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
@ -64,20 +67,20 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=7
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE APP DATA DIR # REMOVE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Removing app data directory..." --weight=1 ynh_script_progression --message="Removing various files..."
# Remove the app directory securely
ynh_secure_remove --file="$datadir"
#=================================================
# REMOVE THE CRON FILE
#=================================================
ynh_script_progression --message="Removing the cron file..."
# Remove a cron file # Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app" ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -29,7 +29,6 @@ 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)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
@ -43,20 +42,13 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# 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"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 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 --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
@ -84,28 +76,8 @@ chmod 750 "$datadir"
chmod -R o-rwx "$datadir" chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir" chown -R $app:www-data "$datadir"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_script_progression --message="Restoring cron file..." --weight=1
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
@ -114,14 +86,41 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies # Define and install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=2 ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=2
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" ynh_psql_execute_file_as_root --database=$db_name --file="./db.sql"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -18,8 +18,8 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
@ -52,6 +52,18 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
fi
# If db_name doesn't exist, create it # If db_name doesn't exist, create it
if [ -z "$db_name" ]; then if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
@ -70,18 +82,6 @@ if [ -z "$datadir" ]; then
ynh_app_setting_set --app=$app --key=datadir --value=$datadir ynh_app_setting_set --app=$app --key=datadir --value=$datadir
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
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -106,14 +106,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
@ -129,6 +121,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low ynh_add_fpm_config --usage=low --footprint=low
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -163,12 +163,12 @@ then
update-alternatives --set php /usr/bin/php$phpversion update-alternatives --set php /usr/bin/php$phpversion
pushd "$final_path" pushd "$final_path"
sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1 ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
sudo -u $app env PATH=$PATH drush @$app cache-clear all ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
# sudo -u $app env PATH=$PATH drush @$app pm-update -y drupal # ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y drupal
# sudo -u $app env PATH=$PATH drush @$app updatedb -y # ynh_exec_as $app env PATH=$PATH drush @$app updatedb -y
sudo -u $app env PATH=$PATH drush @$app cache-clear all ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0 ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0
popd popd
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}