1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/drupal_ynh.git synced 2024-09-03 18:35:53 +02:00

Apply example_ynh

Apply example_ynh
This commit is contained in:
yalh76 2020-02-24 19:45:14 +01:00 committed by GitHub
commit d4592600ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 44 additions and 6 deletions

View file

@ -31,7 +31,6 @@ LDAP module can be installed
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/drupal%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/drupal/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/drupal%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/drupal/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/drupal%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/drupal/)
## Links

View file

@ -31,7 +31,6 @@ Le module d'authentification LDAP peut être installé
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/drupal%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/drupal/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/drupal%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/drupal/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/drupal%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/drupal/)
## Liens

View file

@ -13,7 +13,11 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -63,6 +67,7 @@ ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# BACKUP A CRON FILE
#=================================================
ynh_print_info --message="Backing up a cron file..."
ynh_backup --src_path="/etc/cron.d/$app"

View file

@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
ynh_print_info --message="Retrieve arguments from the manifest"
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
@ -34,6 +35,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before changing its url (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================

View file

@ -16,13 +16,18 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
ynh_print_info --message="Retrieving arguments from the manifest..."
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
@ -31,7 +36,6 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
password=$YNH_APP_ARG_PASSWORD
install_profil=$YNH_APP_ARG_INSTALL_PROFIL
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
app=$YNH_APP_INSTANCE_NAME
@ -163,7 +167,7 @@ popd
#=================================================
# SET THE CRON FILE
#=================================================
ynh_print_info --message="Setting the cron file"
ynh_print_info --message="Setting the cron file..."
cp ../conf/cron /etc/cron.d/$app
@ -173,6 +177,7 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_fil
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_print_info --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
@ -190,6 +195,7 @@ ynh_add_fpm_config --phpversion="7.2"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path

View file

@ -80,6 +80,7 @@ ynh_del_swap
#=================================================
# REMOVE THE CRON FILE
#=================================================
ynh_print_info --message="Removing the cron file..."
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -16,7 +16,11 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -48,6 +52,7 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Restoring the nginx configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -69,6 +74,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_print_info --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
@ -96,6 +102,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Restoring PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/7.2/fpm/pool.d/$app.conf"

View file

@ -28,9 +28,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
##=================================================
#=================================================
# CHECK VERSION
#=================================================
ynh_print_info --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -154,6 +155,7 @@ popd
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_print_info --message="Storing the config file checksum..."
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
@ -175,6 +177,7 @@ ynh_systemd_action --service_name=cron --action=restart
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info --message="Securing files and directories..."
# Set permissions on app files
chown -R $app: $final_path

View file

@ -41,7 +41,7 @@ ynh_install_php () {
ynh_pin_repo --package="*" --pin="origin \"packages.sury.org\"" 200 --name=extra_php_version
ynh_pin_repo --package="php7.0*" --pin="origin \"packages.sury.org\"" 600 --name=extra_php_version --append
# Advertise service in admin panel
# INTEGRATE SERVICE IN YUNOHOST
yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log"
}