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

Apply example_ynh

This commit is contained in:
yalh76 2022-07-29 01:12:30 +02:00
parent df06d0a3fc
commit 26b59efcaa
11 changed files with 152 additions and 146 deletions

View file

@ -2,9 +2,9 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
language="fr"
is_public=1
language="fr"
admin="john"
password="password"
expiration="0"
deletion="0"
@ -16,8 +16,11 @@
setup_private=1
setup_public=1
upgrade=1
# 1.0.3~ynh3
upgrade=1 from_commit=79cdc1a139ff06805647cb56e5eab1d595ee0259
backup_restore=1
multi_instance=1
port_already_use=0
change_url=1
;;; Options
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"
},
"version": "1.0.3~ynh3",
"url": "https://framagit.org/framasoft/framaforms",
"url": "https://framaforms.org",
"upstream": {
"license": "GPL-2.0-only",
"requirements": {
"yunohost": ">= 4.3.0"
"website": "https://framaforms.org",
"code": "https://framagit.org/framasoft/framaforms"
},
"license": "GPL-2.0-only",
"maintainer": {
"name": "ljf",
"email": "ljf+framaforms_ynh@reflexlibre.net",
"url": "https://reflexlibre.net"
},
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
"nginx",
@ -24,7 +29,7 @@
"mysql"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -36,12 +41,13 @@
"default": "/poll"
},
{
"name": "admin",
"type": "user"
"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."
},
{
"name": "password",
"type": "password"
"default": true
},
{
"name": "language",
@ -53,6 +59,14 @@
"choices": ["de", "en", "es", "fr", "it", "pt"],
"default": "en"
},
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "password"
},
{
"name": "expiration",
"type": "string",
@ -78,15 +92,6 @@
"fr": "Mettre 0 pour désactiver la suppression"
},
"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
#=================================================
# BACKUP A CRON FILE
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"

View file

@ -22,16 +22,17 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
expiration=$YNH_APP_ARG_EXPIRATION
deletion=$YNH_APP_ARG_DELETION
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
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
#=================================================
@ -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=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=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=deletion --value=$deletion
@ -98,14 +99,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$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
#=================================================
@ -115,6 +108,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
ynh_add_fpm_config --usage=low --footprint=low
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
#=================================================
@ -165,21 +166,11 @@ datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$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
#=================================================
@ -196,54 +187,54 @@ chown $app:$app "$final_path/app/sites/default/settings.php"
ynh_script_progression --message="Installing database..." --weight=19
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
sudo -u $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
sudo -u $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 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 variable-set update_notify_emails "$admin_mail"
ynh_exec_as $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 pm-enable framaforms_feature -y --resolve-dependencies 2>&1
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
#=================================================
ynh_script_progression --message="Importing language pack..." --weight=5
sudo -u $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
sudo -u $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
sudo -u $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
sudo -u $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 pm-download -y drush_language 2>&1
ynh_exec_as $app env PATH=$PATH drush @$app pm-download -y l10n_update 2>&1
ynh_exec_as $app env PATH=$PATH drush @$app pm-enable -y l10n_update 2>&1
ynh_exec_as $app env PATH=$PATH drush @$app language-add $language -y 2>&1
ynh_exec_as $app env PATH=$PATH drush @$app language-default $language -y 2>&1
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear drush -y 2>&1
ynh_exec_as $app env PATH=$PATH drush @$app l10n-update-refresh -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
# in drupal core and modules code
# 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
#=================================================
ynh_script_progression --message="Removing branding and change default settings..." --weight=1
sudo -u $app env PATH=$PATH drush @$app vset error_level 0
sudo -u $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 error_level 0
ynh_exec_as $app env PATH=$PATH drush @$app vset framaforms_notification_period_value $expiration
ynh_exec_as $app env PATH=$PATH drush @$app vset framaforms_deletion_period_value $deletion
# 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
#=================================================
ynh_script_progression --message="Configuring LDAP authentication..." --weight=1
sudo -u $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-download ldap
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
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);"
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_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_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}

View file

@ -27,18 +27,10 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# 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
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
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
@ -48,6 +40,17 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
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
#=================================================
@ -64,20 +67,20 @@ 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=7
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE APP DATA DIR
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing app data directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$datadir"
#=================================================
# REMOVE THE CRON FILE
#=================================================
ynh_script_progression --message="Removing the cron file..."
ynh_script_progression --message="Removing various files..."
# Remove a cron file
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)
db_name=$(ynh_app_setting_get --app=$app --key=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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
@ -43,20 +42,13 @@ 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
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# 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
@ -84,28 +76,8 @@ chmod 750 "$datadir"
chmod -R o-rwx "$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
#=================================================
# 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
#=================================================
@ -114,14 +86,41 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install 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
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=2
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_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

View file

@ -18,8 +18,8 @@ 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)
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)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
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
# 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 [ -z "$db_name" ]; then
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
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
#=================================================
@ -106,14 +106,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$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
#=================================================
@ -129,6 +121,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
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
#=================================================
@ -163,12 +163,12 @@ then
update-alternatives --set php /usr/bin/php$phpversion
pushd "$final_path"
sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
sudo -u $app env PATH=$PATH drush @$app cache-clear all
# sudo -u $app env PATH=$PATH drush @$app pm-update -y drupal
# sudo -u $app env PATH=$PATH drush @$app updatedb -y
sudo -u $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 1
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
# ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y drupal
# ynh_exec_as $app env PATH=$PATH drush @$app updatedb -y
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0
popd
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}