mirror of
https://github.com/YunoHost-Apps/drupal7_ynh.git
synced 2024-09-03 18:26:19 +02:00
Implement upgrade
This commit is contained in:
parent
6b1585fb36
commit
57c101e4e3
1 changed files with 33 additions and 39 deletions
|
@ -7,6 +7,9 @@
|
|||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source ynh_add_extra_apt_repos__3
|
||||
source ynh_install_php__3
|
||||
source ynh_composer__2
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -64,18 +67,6 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
# N.B. : this is for app installations before YunoHost 2.7
|
||||
# where this value might be something like /foo/ or foo/
|
||||
# instead of /foo ....
|
||||
# If nobody installed your app before 2.7, then you may
|
||||
# safely remove this line
|
||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -84,7 +75,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
|||
ynh_print_info --message="Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
#ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -92,14 +83,15 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
ynh_print_info --message="Upgrading nginx web server configuration..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
ynh_add_nginx_config "app"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
#ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -107,7 +99,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
ynh_print_info --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
|
@ -115,35 +107,37 @@ ynh_system_user_create --username=$app
|
|||
ynh_print_info --message="Upgrading php-fpm configuration..."
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
ynh_add_fpm_config --phpversion="7.2"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# ...
|
||||
# UPDATE COMPOSER
|
||||
#=================================================
|
||||
ynh_print_info --message="Updating Composer..."
|
||||
|
||||
ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer"
|
||||
|
||||
#=================================================
|
||||
# UPDATE DRUPAL
|
||||
#=================================================
|
||||
ynh_print_info --message="Updating Drupal..."
|
||||
|
||||
export PATH="$final_path/.composer/vendor/bin:$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 drupal
|
||||
sudo -u $app env PATH=$PATH drush @$app vset --exact maintenance_mode 0
|
||||
sudo -u $app env PATH=$PATH drush @$app cache-clear all
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE"
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php"
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/CONFIG_FILE"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -152,7 +146,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R root: $final_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
Loading…
Reference in a new issue