#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= # ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 #================================================= # UPGRADE COMPOSER #================================================= ynh_script_progression --message="Upgrading Composer..." --weight=1 ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir/.composer" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= mkdir -p "$install_dir/$app" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" export PATH="$install_dir/.composer/vendor/bin:$PATH" #================================================= # UPGRADE DRUPAL #================================================= ynh_script_progression --message="Upgrading Drupal..." --weight=1 ynh_backup_if_checksum_is_different --file="$install_dir/$app/sites/default/settings.php" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" 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" cache-clear all _ynh_exec_with_drush_php drush "@$app" l10n-update-refresh _ynh_exec_with_drush_php drush "@$app" l10n-update _ynh_exec_with_drush_php drush "@$app" variable-set --exact maintenance_mode 0 chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" popd ynh_store_file_checksum --file="$install_dir/$app/sites/default/settings.php" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config ynh_add_config --template="cron" --destination="/etc/cron.d/$app" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last