mirror of
https://github.com/YunoHost-Apps/drupal7_ynh.git
synced 2024-09-03 18:26:19 +02:00
commit
af3353e638
10 changed files with 152 additions and 165 deletions
|
@ -29,8 +29,8 @@ LDAP module can be installed
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/drupal7/)
|
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/drupal7/)
|
||||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/drupal7/)
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/drupal7/)
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ Le module d'authentification LDAP peut être installé
|
||||||
|
|
||||||
#### Architectures supportées
|
#### Architectures supportées
|
||||||
|
|
||||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/drupal7/)
|
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/drupal7/)
|
||||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/drupal7/)
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/drupal7/)
|
||||||
|
|
||||||
## Liens
|
## Liens
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,11 @@
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
# 7.0~ynh1
|
# 7.0~ynh1
|
||||||
# upgrade=1 from_commit=89bf310b8ac87a61e5974508f2b41fbb32823e95
|
#upgrade=1 from_commit=89bf310b8ac87a61e5974508f2b41fbb32823e95
|
||||||
# 7.73~ynh1
|
# 7.73~ynh1
|
||||||
# upgrade=1 from_commit=6c565bad2d6083eac25eaee126d9eb32595d94b4
|
#upgrade=1 from_commit=6c565bad2d6083eac25eaee126d9eb32595d94b4
|
||||||
|
# 7.78~ynh1
|
||||||
|
upgrade=1 from_commit=868272f6dfc0a0ccac75982b224628564f10123e
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
@ -31,3 +33,5 @@ Notification=all
|
||||||
name=7.0~ynh1
|
name=7.0~ynh1
|
||||||
; commit=6c565bad2d6083eac25eaee126d9eb32595d94b4
|
; commit=6c565bad2d6083eac25eaee126d9eb32595d94b4
|
||||||
name=7.73~ynh1
|
name=7.73~ynh1
|
||||||
|
; commit=868272f6dfc0a0ccac75982b224628564f10123e
|
||||||
|
name=7.78~ynh1
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Old version of a content management framework written in PHP",
|
"en": "Old version of a content management framework written in PHP",
|
||||||
"fr": "Ancienne version d'un système de gestion de contenu écrit en PHP"
|
"fr": "Ancienne version d'un système de gestion de contenu écrit en PHP"
|
||||||
},
|
},
|
||||||
"version": "7.78~ynh1",
|
"version": "7.78~ynh2",
|
||||||
"url": "https://www.drupal.org",
|
"url": "https://www.drupal.org",
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -26,38 +26,22 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain name for Drupal 7",
|
|
||||||
"fr": "Choisissez un nom de domaine pour Drupal 7"
|
|
||||||
},
|
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for Drupal 7",
|
|
||||||
"fr": "Choisissez un chemin pour Drupal 7"
|
|
||||||
},
|
|
||||||
"example": "/drupal7",
|
"example": "/drupal7",
|
||||||
"default": "/drupal7"
|
"default": "/drupal7"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
|
||||||
"en": "Choose an admin user",
|
|
||||||
"fr": "Choisissez l'administrateur"
|
|
||||||
},
|
|
||||||
"example": "johndoe"
|
"example": "johndoe"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
|
||||||
"en": "Is it a public application?",
|
|
||||||
"fr": "Est-ce une application publique ?"
|
|
||||||
},
|
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -73,10 +57,6 @@
|
||||||
{
|
{
|
||||||
"name": "password",
|
"name": "password",
|
||||||
"type": "password",
|
"type": "password",
|
||||||
"ask": {
|
|
||||||
"en": "Set the administrator password",
|
|
||||||
"fr": "Définissez le mot de passe administrateur"
|
|
||||||
},
|
|
||||||
"example": "Choose a password"
|
"example": "Choose a password"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..."
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -45,7 +45,7 @@ ynh_clean_setup () {
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
# 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"
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -72,23 +72,23 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating nginx web server configuration..."
|
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
# Change the path in the nginx config file
|
# Change the path in the NGINX config file
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original NGINX config file if modified
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
# Set global variables for nginx helper
|
# Set global variables for NGINX helper
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
|
@ -114,7 +114,7 @@ ynh_add_config --template="../conf/yoursite.aliases.drushrc.php" --destination="
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading nginx web server..."
|
ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ ynh_script_progression --message="Storing installation settings..."
|
||||||
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=admin --value=$admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
|
||||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
ynh_app_setting_set --app=$app --key=install_profil --value=$install_profil
|
ynh_app_setting_set --app=$app --key=install_profil --value=$install_profil
|
||||||
|
|
||||||
|
@ -67,6 +66,14 @@ ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -85,28 +92,24 @@ ynh_script_progression --message="Creating final path..."
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
mkdir -p "$final_path/$app"
|
mkdir -p "$final_path/$app"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring nginx web server..."
|
ynh_script_progression --message="Configuring NGINX web server..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..."
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring php-fpm..."
|
ynh_script_progression --message="Configuring PHP-FPM..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
|
@ -139,30 +142,38 @@ export PATH="$final_path/.composer/vendor/bin:$PATH"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing Drupal..."
|
ynh_script_progression --message="Installing Drupal..."
|
||||||
|
|
||||||
chown -R $app: $final_path
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
update-alternatives --set php /usr/bin/php$phpversion
|
update-alternatives --set php /usr/bin/php$phpversion
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush pm-download -y drupal-7 --drupal-project-rename=$app
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush pm-download -y drupal-7 --drupal-project-rename=$app
|
||||||
|
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app site-install $install_profil --account-name=$admin --account-pass=$password --account-mail=$admin_mail --db-url=mysql://$db_user:$db_pwd@localhost/$db_name --site-name="$app" --locale=$language --yes
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download drush_language
|
||||||
|
#ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download ldap
|
||||||
|
#ynh_exec_warn_less 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_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download l10n_update
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-enable -y l10n_update
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app language-add $language
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app language-default $language
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear drush
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-update
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app core-cron
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app site-install $install_profil --account-name=$admin --account-pass=$password --account-mail=$admin_mail --db-url=mysql://$db_user:$db_pwd@localhost/$db_name --site-name="$app" --locale=$language --yes
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download drush_language
|
|
||||||
#ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download ldap
|
|
||||||
#ynh_exec_warn_less 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_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download l10n_update
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-enable -y l10n_update
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app language-add $language
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app language-default $language
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear drush
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-update
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app core-cron
|
|
||||||
|
|
||||||
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
|
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
|
||||||
|
|
||||||
|
ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP THE CRON FILE
|
# SETUP THE CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -170,24 +181,8 @@ ynh_script_progression --message="Setuping the cron file..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --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"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Securing files and directories..."
|
|
||||||
|
|
||||||
# Set permissions to app files
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -204,7 +199,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading nginx web server..."
|
ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
|
@ -50,17 +50,17 @@ ynh_secure_remove --file="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing nginx web server configuration..."
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing php-fpm configuration..."
|
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading settings..."
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -49,17 +49,10 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the nginx configuration..."
|
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -69,12 +62,15 @@ ynh_script_progression --message="Recreating the dedicated system user..."
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring user rights..."
|
ynh_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
# Restore permissions on app files
|
ynh_restore_file --origin_path="$final_path"
|
||||||
chown -R $app: $final_path
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
@ -90,6 +86,12 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE CRON FILE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -107,18 +109,12 @@ 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_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
|
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE CRON FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading nginx web server and php-fpm..."
|
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
126
scripts/upgrade
126
scripts/upgrade
|
@ -23,6 +23,7 @@ admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
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)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -51,7 +52,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -59,12 +60,33 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
|
then
|
||||||
|
mkdir -p "$final_path/$app"
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading nginx web server configuration..."
|
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -74,60 +96,17 @@ ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading php-fpm configuration..."
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
|
||||||
# UPGRADE COMPOSER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading Composer..."
|
|
||||||
|
|
||||||
ynh_install_composer --phpversion="$phpversion" --workdir="$final_path/.composer"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DRUPAL
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading Drupal..."
|
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php"
|
|
||||||
export PATH="$final_path/.composer/vendor/bin:$PATH"
|
|
||||||
|
|
||||||
update-alternatives --set php /usr/bin/php$phpversion
|
|
||||||
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear all
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-update -y drupal
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear all
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update
|
|
||||||
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0
|
|
||||||
|
|
||||||
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --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"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP THE CRON FILE
|
# SETUP THE CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -135,20 +114,53 @@ ynh_script_progression --message="Setuping the cron file"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE COMPOSER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading Composer..."
|
||||||
|
|
||||||
|
ynh_install_composer --phpversion="$phpversion" --workdir="$final_path/.composer"
|
||||||
|
|
||||||
|
export PATH="$final_path/.composer/vendor/bin:$PATH"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DRUPAL
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading Drupal..."
|
||||||
|
|
||||||
|
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
update-alternatives --set php /usr/bin/php$phpversion
|
||||||
|
|
||||||
|
pushd "$final_path"
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear all
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-update -y drupal
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear all
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update
|
||||||
|
|
||||||
|
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
popd
|
||||||
|
|
||||||
|
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
|
||||||
|
|
||||||
|
ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Securing files and directories..."
|
|
||||||
|
|
||||||
# Set permissions on app files
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading nginx web server..."
|
ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue