1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/limesurvey_ynh.git synced 2024-09-03 19:36:32 +02:00

Merge pull request #58 from YunoHost-Apps/testing

Apply last example_ynh
This commit is contained in:
yalh76 2022-06-19 18:38:04 +02:00 committed by GitHub
commit 73fa31321a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 236 additions and 210 deletions

19
.gitattributes vendored
View file

@ -1,19 +0,0 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
# Declare files that will always have LF line endings on checkout.
*.php text eol=lf
*.css text eol=lf
*.js text eol=lf
*.pstpl text eol=lf
*.html text eol=lf
*.sql text eol=lf
*.txt text eol=lf
*.lss text eol=lf
# Denote all files that are truly binary and should not be modified.
*.jpg binary
*.png binary
*.gif binary
*.ico binary
*.mo binary

1
.gitignore vendored
View file

@ -1 +0,0 @@

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# LimeSurvey for YunoHost
[![Integration level](https://dash.yunohost.org/integration/limesurvey.svg)](https://dash.yunohost.org/appci/app/limesurvey) ![](https://ci-apps.yunohost.org/ci/badges/limesurvey.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/limesurvey.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/limesurvey.svg)](https://dash.yunohost.org/appci/app/limesurvey) ![Working status](https://ci-apps.yunohost.org/ci/badges/limesurvey.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/limesurvey.maintain.svg)
[![Install LimeSurvey with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=limesurvey)
*[Lire ce readme en français.](./README_fr.md)*
@ -17,13 +17,11 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Create and distribute surveys
**Shipped version:** 5.2.6~ynh2
**Shipped version:** 5.2.6~ynh3
## Screenshots
![](./doc/screenshots/create_html_statistic_screen.png)
![Screenshot of LimeSurvey](./doc/screenshots/create_html_statistic_screen.png)
## Disclaimers / important information
@ -32,22 +30,23 @@ Create and distribute surveys
* The application is integrated with YunoHost accounts (LDAP database)
## Documentation and resources
* Official app website: https://www.limesurvey.org
* Official user documentation: https://help.limesurvey.org
* Official admin documentation: https://manual.limesurvey.org/LimeSurvey_Manual/fr
* Upstream app code repository: https://github.com/LimeSurvey/LimeSurvey
* YunoHost documentation for this app: https://yunohost.org/app_limesurvey
* Report a bug: https://github.com/YunoHost-Apps/limesurvey_ynh/issues
* Official app website: <https://www.limesurvey.org>
* Official user documentation: <https://help.limesurvey.org>
* Official admin documentation: <https://manual.limesurvey.org/LimeSurvey_Manual/fr>
* Upstream app code repository: <https://github.com/LimeSurvey/LimeSurvey>
* YunoHost documentation for this app: <https://yunohost.org/app_limesurvey>
* Report a bug: <https://github.com/YunoHost-Apps/limesurvey_ynh/issues>
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
or
sudo yunohost app upgrade limesurvey -u https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
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.
-->
# LimeSurvey pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/limesurvey.svg)](https://dash.yunohost.org/appci/app/limesurvey) ![](https://ci-apps.yunohost.org/ci/badges/limesurvey.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/limesurvey.maintain.svg)
[![Niveau d'intégration](https://dash.yunohost.org/integration/limesurvey.svg)](https://dash.yunohost.org/appci/app/limesurvey) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/limesurvey.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/limesurvey.maintain.svg)
[![Installer LimeSurvey avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=limesurvey)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer LimeSurvey 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.*
@ -13,13 +17,11 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Outil de création et diffusion de sondage
**Version incluse :** 5.2.6~ynh2
**Version incluse :** 5.2.6~ynh3
## Captures d'écran
![](./doc/screenshots/create_html_statistic_screen.png)
![Capture d'écran de LimeSurvey](./doc/screenshots/create_html_statistic_screen.png)
## Avertissements / informations importantes
@ -28,22 +30,23 @@ Outil de création et diffusion de sondage
* The application is integrated with YunoHost accounts (LDAP database)
## Documentations et ressources
* Site officiel de l'app : https://www.limesurvey.org
* Documentation officielle utilisateur : https://help.limesurvey.org
* Documentation officielle de l'admin : https://manual.limesurvey.org/LimeSurvey_Manual/fr
* Dépôt de code officiel de l'app : https://github.com/LimeSurvey/LimeSurvey
* Documentation YunoHost pour cette app : https://yunohost.org/app_limesurvey
* Signaler un bug : https://github.com/YunoHost-Apps/limesurvey_ynh/issues
* Site officiel de l'app : <https://www.limesurvey.org>
* Documentation officielle utilisateur : <https://help.limesurvey.org>
* Documentation officielle de l'admin : <https://manual.limesurvey.org/LimeSurvey_Manual/fr>
* Dépôt de code officiel de l'app : <https://github.com/LimeSurvey/LimeSurvey>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_limesurvey>
* Signaler un bug : <https://github.com/YunoHost-Apps/limesurvey_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
ou
sudo yunohost app upgrade limesurvey -u https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -2,8 +2,9 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
language="en"
admin="john"
password="1Strong-Password"
is_admin_public=1
; Checks
pkg_linter=1
@ -13,8 +14,10 @@
setup_private=0
setup_public=1
upgrade=1
#3.17.1
# 3.17.1~ynh1
upgrade=1 from_commit=da4959616e67f89ef907a223f7c84607dc4771e5
# 5.2.6~ynh2
upgrade=1 from_commit=58cac7dfc0d0b835898d56238e550c775be7255b
backup_restore=1
multi_instance=1
port_already_use=0

View file

@ -2,5 +2,6 @@ SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/refs/tags/5.2.6+2112
SOURCE_SUM=d097af55794000d87ad8f88698597f6cba2e972499819d3f4bd55748f1de1765
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=limesurvey.tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -28,10 +28,10 @@ return array(
'db' => array(
'connectionString' => 'mysql:host=localhost;port=3306;dbname=__DB_NAME__;',
'emulatePrepare' => true,
'username' => '__DB_NAME__',
'username' => '__DB_USER__',
'password' => '__DB_PWD__',
'charset' => 'utf8mb4',
'tablePrefix' => 'lime_',
'tablePrefix' => '__PREFIX__',
),
'emcache' => array('class' => 'CFileCache'),
@ -65,7 +65,7 @@ return array(
// 'use_asset_manager'=>true, // Uncomment if you want to use debug mode and asset manager at the same time
'enableLdap' => true,
'force_ssl' => true,
'uploaddir' => '__DATADIR__'
'uploaddir' => '__DATADIR__/upload'
)
);
/* End of file config.php */

View file

@ -1,12 +1,12 @@
UPDATE lime_plugins SET active=1 WHERE name="AuthLDAP";
UPDATE __PREFIX__plugins SET active=1 WHERE name="AuthLDAP";
INSERT INTO `lime_permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES
INSERT INTO `__PREFIX__permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES
(2,'global',0,2,'auth_ldap',0,1,0,0,0,0),
(3,'global',0,2,'surveys',1,0,0,0,0,0);
INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES
INSERT INTO `__PREFIX__plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES
(2, 5, NULL, NULL, 'server', '\"ldap:\\/\\/localhost\"'),
(3, 5, NULL, NULL, 'ldapport', '\"\"'),
(4, 5, NULL, NULL, 'ldapversion', '\"3\"'),
@ -35,6 +35,6 @@ INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key
#(24, 7, NULL, NULL, 'serverkey', '"REMOTE_USER"'),
#(25, 7,NULL,NULL,'is_default','\"1\"');
INSERT INTO `lime_settings_global` VALUES
INSERT INTO `__PREFIX__settings_global` VALUES
('defaultlang','__LANGUAGE__'),
('AssetsVersion','30214');

View file

@ -8,15 +8,10 @@ location __PATH__/ {
index index.php;
# if (!-e $request_filename)
#{
# rewrite ^(.+)$ __PATH__/index.php?q=$1 last;
#}
client_max_body_size 50m;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
client_max_body_size 50M;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;

View file

@ -6,7 +6,7 @@
"en": "Create and distribute surveys",
"fr": "Outil de création et diffusion de sondage"
},
"version": "5.2.6~ynh2",
"version": "5.2.6~ynh3",
"url": "https://www.limesurvey.org/",
"upstream": {
"license": "GPL-2.0+",
@ -42,10 +42,6 @@
"example": "/poll",
"default": "/poll"
},
{
"name": "admin",
"type": "user"
},
{
"name": "language",
"type": "string",
@ -168,6 +164,14 @@
],
"default": "en"
},
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "password"
},
{
"name": "is_admin_public",
"type": "boolean",
@ -176,10 +180,6 @@
"fr": "En mode privé, seuls les utilisateurs YunoHost autorisés peuvent créer un sondage. En mode public, il est possible de créer un sondage avec un compte Limesurvey mais sans compte YunoHost."
},
"default": true
},
{
"name": "password",
"type": "password"
}
]
}

View file

@ -8,6 +8,7 @@ PKG_DIR=$(cd ../; pwd)
YNH_PHP_VERSION="7.3"
# dependencies used by the app
pkg_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-imap python3-pip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring"
#=================================================

View file

@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -25,10 +28,10 @@ ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -41,6 +44,12 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
@ -60,13 +69,6 @@ ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# BACKUP THE DATA DIRECTORY
#=================================================
ynh_print_info --message="Backing up data directory..."
ynh_backup --src_path="$datadir" --is_big
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -67,6 +67,8 @@ then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
@ -96,6 +98,8 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -22,13 +25,15 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_admin_public=$YNH_APP_ARG_IS_ADMIN_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
is_admin_public=$YNH_APP_ARG_IS_ADMIN_PUBLIC
app=$YNH_APP_INSTANCE_NAME
prefix=lime_
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
@ -47,8 +52,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=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=admin --value=$admin
ynh_app_setting_set --app=$app --key=prefix --value=$prefix
#=================================================
# STANDARD MODIFICATIONS
@ -89,9 +95,15 @@ ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 750 "$final_path/tmp"
chmod 750 "$final_path/upload"
chmod 750 "$final_path/application/config/"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
@ -101,55 +113,55 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE THE DATA DIRECTORY
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/limesurvey/upload
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
mkdir -p $datadir/upload
# Remove upload if empty
rmdir $datadir 2> /dev/null && mv "$final_path/upload" $datadir || true
chown -R $app:www-data "$datadir"
chmod -R o-rwx "$datadir"
ln -s $datadir $final_path/upload 2> /dev/null || true
chown -R $app:www-data "$datadir"
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
#=================================================
# CONFIGURE
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring Limesurvey..." --weight=1
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/config.php" --destination="$final_path/application/config/config.php"
chmod 400 "$final_path/application/config/config.php"
chown $app:$app "$final_path/application/config/config.php"
#=================================================
# INSTALL
# INSTALL APP
#=================================================
ynh_script_progression --message="Installing app..."
ls_cli=$final_path/application/commands/console.php
fullname=$(ynh_user_get_info "$admin" "fullname")
mail=$(ynh_user_get_info "$admin" "mail")
fullname=$(ynh_user_get_info --username="$admin" --key="fullname")
mail=$(ynh_user_get_info --username="$admin" --key="mail")
# Permission should be correctly set before to do this
ynh_exec_as "$app" php $ls_cli install "$admin" "$password" "$fullname" "$mail"
ynh_exec_as "$app" php$phpversion $ls_cli install "$admin" "$password" "$fullname" "$mail"
# Permission should be correctly set before to do this
#ynh_exec_as "$app" php $ls_cli install "$admin" "$(ynh_string_random 24)" "$fullname" "$mail"
#ynh_exec_as "$app" php$phpversion $ls_cli install "$admin" "$(ynh_string_random 24)" "$fullname" "$mail"
#=================================================
# LOAD SQL SPECIFIC CONFIG
#=================================================
ynh_script_progression --message="Loading SQL specific config..."
ynh_add_config --template="../conf/data.sql" --destination="./data.sql"
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./data.sql
@ -157,30 +169,30 @@ ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name
ynh_secure_remove --file=./data.sql
#=================================================
# Add nice themes
# ADD NICE THEMES
#=================================================
#ynh_script_progression --message="Adding nice themes..."
#ynh_setup_source "$datadir/upload/templates/libreform" libreform
#ynh_setup_source "$final_path/upload/templates/librepoll" librepoll
#=================================================
# SETUP FAIL2BAN
#=================================================
# No message in logs and the apps contains already a 10 minutes ban policy
# GENERIC FINALIZATION
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
if [ $is_admin_public -eq 1 ]
then
allowed_groups="visitors $admin"
else
allowed_groups="$admin"
fi
ynh_permission_update --permission="main" --show_tile="false" --add="visitors"
ynh_permission_create --permission="admin" --url="/admin" --allowed=$allowed_groups --show_tile="true"

View file

@ -1,7 +1,7 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -24,14 +24,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
@ -41,7 +33,7 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE THE MAIN DIR OF THE APP
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
@ -60,7 +52,7 @@ then
fi
#=================================================
# REMOVE THE NGINX CONFIGURATION
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
@ -75,6 +67,16 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE DEDICATED USER
#=================================================

View file

@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -27,11 +30,10 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
admin=$(ynh_app_setting_get --app=$app --key=admin)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -43,13 +45,6 @@ test ! -d $final_path \
#=================================================
# 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
#=================================================
@ -68,15 +63,20 @@ ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 755 "$final_path/tmp"
chmod 755 "$final_path/application/config/"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_script_progression --message="Restoring the data directory..." --weight=2
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p "$datadir/upload"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
#=================================================
# SPECIFIC RESTORATION
@ -88,6 +88,20 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# 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 MYSQL DATABASE
#=================================================
@ -97,19 +111,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring data directory..." --weight=2
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p "$datadir"
chown -R $app:www-data "$datadir"
chmod -R o-rwx "$datadir"
ln -s $datadir $final_path/upload 2> /dev/null || true
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -20,16 +20,18 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
prefix=$(ynh_app_setting_get $app prefix)
prefix=$(ynh_app_setting_get --app=$app --key=prefix)
is_admin_public=$(ynh_app_setting_get --app=$app --key=is_admin_public)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -41,12 +43,14 @@ ynh_script_progression --message="Backing up $app before upgrading (may take a w
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -64,6 +68,12 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If prefix doesn't exist, create it
if [ -z "$prefix" ]; then
prefix="lime_"
ynh_app_setting_set --app=$app --key=prefix --value=$prefix
fi
# If datadir doesn't exist, create it
if [ -z "$datadir" ]; then
datadir=/home/yunohost.app/$app/upload
@ -73,19 +83,26 @@ if [ -z "$datadir" ]; then
rmdir $datadir 2> /dev/null && mv "$final_path/upload" $datadir || true
chown -R $app:www-data "$datadir"
chmod -R o-rwx "$datadir"
ln -s $datadir $final_path/upload
ln -s $datadir/upload $final_path/upload
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_admin_public
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
if [ $is_admin_public -eq 1 ]
then
allowed_groups="visitors $admin"
else
allowed_groups="$admin"
fi
ynh_permission_create --permission="admin" --url="/admin" --allowed=$allowed_groups --show_tile="true"
fi
# Create a permission if needed
@ -101,8 +118,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -122,15 +137,7 @@ chmod 750 "$final_path/tmp"
chmod 750 "$final_path/application/config/"
chown -R $app:www-data "$datadir"
chmod 750 $datadir
ln -s $datadir $final_path/upload 2> /dev/null || true
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
#=================================================
# UPGRADE DEPENDENCIES
@ -148,19 +155,35 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
ynh_add_fpm_config
#=================================================
# CONFIGURE
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring Limesurvey..." --weight=1
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="../conf/config.php" --destination="$final_path/application/config/config.php"
chmod 400 "$final_path/application/config/config.php"
chown $app:$app "$final_path/application/config/config.php"
#=================================================
# UPGRADE DB
#=================================================
ynh_script_progression --message="Upgrading DB..."
# Migrate DB
ynh_exec_as "$app" php $final_path/application/commands/console.php updatedb
ynh_exec_as "$app" php$phpversion $final_path/application/commands/console.php updatedb
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================