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

79 lines
3.6 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
# ynh_script_progression "Ensuring downward compatibility..."
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/app" --full_replace --keep="sites"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
chmod -R o-rwx "$data_dir"
chown -R "$app:www-data" "$data_dir"
#=================================================
# UPGRADE COMPOSER
#=================================================
ynh_script_progression "Upgrading Composer..."
ynh_composer_install
ynh_composer_exec install --no-dev # FIXMEhelpers2.1 (replace with composer_workdir=... prior to calling this helper, default is $intall_dir) --workdir="$install_dir/.composer"
#=================================================
# UPGRADE DRUPAL
#=================================================
ynh_script_progression "Upgrading Drupal..."
ynh_backup_if_checksum_is_different "$install_dir/app/sites/default/settings.php"
# Chown from composer/drush install
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
pushd "$install_dir"
_ynh_exec_with_drush_php drush "@$app" variable-set --exact maintenance_mode 1
_ynh_exec_with_drush_php drush "@$app" cache-clear all
# _ynh_exec_with_drush_php drush "@$app" pm-update -y drupal
# _ynh_exec_with_drush_php drush "@$app" updatedb -y
_ynh_exec_with_drush_php drush "@$app" cache-clear all
_ynh_exec_with_drush_php drush "@$app" variable-set --exact maintenance_mode 0
popd
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression "Updating configuration..."
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 600 "$install_dir/app/sites/default/settings.php"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/app/sites/default/settings.php"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated PHP-FPM config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_config_add_nginx
ynh_config_add --template="cron" --destination="/etc/cron.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"