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

Merge pull request #21 from YunoHost-Apps/PHP7.3

Upgrading to PHP7.3
This commit is contained in:
yalh76 2020-03-28 19:02:36 +01:00 committed by GitHub
commit 97a1615471
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 65 additions and 33 deletions

View file

@ -11,7 +11,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
## Overview ## Overview
Free and open-source content management framework. Free and open-source content management framework.
**Shipped version:** 8.8.1 **Shipped version:** 8.8.4
## Screenshots ## Screenshots

View file

@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble ## Vue d'ensemble
Framework de gestion de contenu libre et open-source. Framework de gestion de contenu libre et open-source.
**Version incluse:** 8.8.1 **Version incluse:** 8.8.4
## Captures d'écran ## Captures d'écran

View file

@ -15,7 +15,8 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=f0af5b7a8e58615fe8ad73e3c1d6fe8d1369f061 # 8.7.1
# upgrade=1 from_commit=f0af5b7a8e58615fe8ad73e3c1d6fe8d1369f061
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.

View file

@ -58,7 +58,7 @@ location __PATH__/ {
location ~ '[^/]\.php$|^/update.php' { location ~ '[^/]\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php7.3-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port; ; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket. ; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory. ; Note: This value is mandatory.
listen = /var/run/php/php7.2-fpm-__NAMETOCHANGE__.sock listen = /var/run/php/php7.3-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog. ; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD) ; Default Value: 511 (-1 on FreeBSD and OpenBSD)

View file

@ -6,7 +6,7 @@
"en": "A content management framework written in PHP", "en": "A content management framework written in PHP",
"fr": "Un système de gestion de contenu écrit en PHP" "fr": "Un système de gestion de contenu écrit en PHP"
}, },
"version": "8.8.1~ynh1", "version": "8.8.4~ynh1",
"url": "https://www.drupal.org", "url": "https://www.drupal.org",
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
"maintainer": { "maintainer": {

View file

@ -7,7 +7,7 @@
# dependencies used by the app # dependencies used by the app
pkg_dependencies="curl" pkg_dependencies="curl"
extra_pkg_dependencies="php7.2-fpm php7.2-cli php7.2-gd php7.2-mysql php7.2-xml php7.2-ldap php7.2-mbstring php7.2-json php7.2-simplexml php7.2-curl" extra_pkg_dependencies="php7.3-fpm php7.3-cli php7.3-gd php7.3-mysql php7.3-xml php7.3-ldap php7.3-mbstring php7.3-json php7.3-simplexml php7.3-curl"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -53,7 +53,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
ynh_print_info --message="Backing up php-fpm configuration..." ynh_print_info --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/7.2/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/7.3/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE

View file

@ -65,6 +65,17 @@ ynh_app_setting_set --app=$app --key=install_profil --value=$install_profil
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#=================================================
# INSTALL PHP7.3
#=================================================
if [ "$(lsb_release --codename --short)" = "buster" ]; then
pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies"
else
ynh_print_info --message="Installing PHP7.3..."
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
fi
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
@ -72,13 +83,6 @@ ynh_print_info --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# INSTALL PHP
#=================================================
ynh_print_info --message="Installing PHP..."
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
@ -117,7 +121,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
# ADD SWAPP # ADD SWAP
#================================================= #=================================================
ynh_print_info --message="Adding swap..." ynh_print_info --message="Adding swap..."
@ -147,7 +151,7 @@ mkdir -p "$final_path/.composer"
cp -f "../conf/composer.json" "$final_path/composer.json" cp -f "../conf/composer.json" "$final_path/composer.json"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/composer.json" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/composer.json"
ynh_install_composer --phpversion="7.2" --workdir="$final_path" ynh_install_composer --phpversion="7.3" --workdir="$final_path"
export PATH="$final_path/vendor/bin:$PATH" export PATH="$final_path/vendor/bin:$PATH"
@ -159,7 +163,7 @@ ynh_print_info --message="Installing Drupal..."
chown -R $app: $final_path chown -R $app: $final_path
pushd "$final_path" pushd "$final_path"
update-alternatives --set php /usr/bin/php7.2 update-alternatives --set php /usr/bin/php7.3
sudo -u $app env PATH=$PATH drush 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 sudo -u $app env PATH=$PATH drush 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
update-alternatives --set php /usr/bin/php7.0 update-alternatives --set php /usr/bin/php7.0
popd popd
@ -190,7 +194,7 @@ ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
ynh_print_info --message="Configuring php-fpm..." ynh_print_info --message="Configuring php-fpm..."
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --phpversion="7.2" ynh_add_fpm_config --phpversion="7.3"
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES

View file

@ -50,7 +50,9 @@ ynh_print_info --message="Removing dependencies..."
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
if [ "$(lsb_release --codename --short)" != "buster" ]; then
ynh_remove_php ynh_remove_php
fi
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
@ -69,7 +71,7 @@ ynh_print_info --message="Removing nginx web server configuration..."
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE SWAPP # REMOVE SWAP
#================================================= #=================================================
ynh_print_info --message="Removing swap..." ynh_print_info --message="Removing swap..."

View file

@ -81,6 +81,17 @@ chown -R $app: $final_path
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#=================================================
# REINSTALL PHP7.3
#=================================================
if [ "$(lsb_release --codename --short)" = "buster" ]; then
pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies"
else
ynh_print_info --message="Reinstalling PHP7.3..."
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
fi
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
@ -88,7 +99,6 @@ ynh_print_info --message="Reinstalling dependencies..."
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
@ -104,7 +114,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#================================================= #=================================================
ynh_print_info --message="Restoring 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" ynh_restore_file --origin_path="/etc/php/7.3/fpm/pool.d/$app.conf"
#================================================= #=================================================
# RESTORE THE CRON FILE # RESTORE THE CRON FILE
@ -113,7 +123,7 @@ ynh_restore_file --origin_path="/etc/php/7.2/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/cron.d/$app" ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
# ADD SWAPP # ADD SWAP
#================================================= #=================================================
ynh_print_info --message="Adding swap..." ynh_print_info --message="Adding swap..."
@ -126,7 +136,7 @@ ynh_add_swap --size=512
#================================================= #=================================================
ynh_print_info --message="Reloading nginx web server and php-fpm..." ynh_print_info --message="Reloading nginx web server and php-fpm..."
ynh_systemd_action --service_name=php7.2-fpm --action=reload ynh_systemd_action --service_name=php7.3-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -85,13 +85,28 @@ ynh_print_info --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# UPGRADE PHP7.3
#=================================================
if [ "$(lsb_release --codename --short)" = "buster" ]; then
pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies"
else
if [ "$(ynh_app_setting_get --app=$app --key=php_version)" != "7.3" ]; then
ynh_print_info --message="Upgrading PHP7.3..."
ynh_remove_fpm_config
ynh_remove_app_dependencies
ynh_remove_php
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
fi
fi
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_print_info --message="Upgrading 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 # CREATE DEDICATED USER
@ -107,12 +122,12 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_print_info --message="Upgrading php-fpm configuration..." ynh_print_info --message="Upgrading php-fpm configuration..."
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --phpversion="7.2" ynh_add_fpm_config --phpversion="7.3"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
# ADD SWAPP # ADD SWAP
#================================================= #=================================================
ynh_print_info --message="Adding swap..." ynh_print_info --message="Adding swap..."
@ -123,8 +138,8 @@ ynh_add_swap --size=512
#================================================= #=================================================
ynh_print_info --message="Upgrading Composer..." ynh_print_info --message="Upgrading Composer..."
update-alternatives --set php /usr/bin/php7.2 update-alternatives --set php /usr/bin/php7.3
ynh_install_composer --phpversion="7.2" --workdir="$final_path" ynh_install_composer --phpversion="7.3" --workdir="$final_path"
update-alternatives --set php /usr/bin/php7.0 update-alternatives --set php /usr/bin/php7.0
#================================================= #=================================================
@ -142,10 +157,10 @@ export PATH="$final_path/vendor/bin:$PATH"
#sudo -u $app env PATH=$PATH drush @$app.prod l10n-update #sudo -u $app env PATH=$PATH drush @$app.prod l10n-update
pushd "$final_path" pushd "$final_path"
update-alternatives --set php /usr/bin/php7.2 update-alternatives --set php /usr/bin/php7.3
sudo -u $app env PATH=$PATH drush @$app.prod state:set system.maintenance_mode 1 --input-format=integer sudo -u $app env PATH=$PATH drush @$app.prod state:set system.maintenance_mode 1 --input-format=integer
sudo -u $app env PATH=$PATH php7.2 composer.phar update drupal/core webflo/drupal-core-require-dev --with-dependencies sudo -u $app env PATH=$PATH php7.3 composer.phar update drupal/core webflo/drupal-core-require-dev --with-dependencies
sudo -u $app env PATH=$PATH php7.2 composer.phar update --with-dependencies sudo -u $app env PATH=$PATH php7.3 composer.phar update --with-dependencies
sudo -u $app env PATH=$PATH drush @$app.prod -y updatedb sudo -u $app env PATH=$PATH drush @$app.prod -y updatedb
sudo -u $app env PATH=$PATH drush @$app.prod cache:rebuild sudo -u $app env PATH=$PATH drush @$app.prod cache:rebuild
sudo -u $app env PATH=$PATH drush @$app.prod state:set system.maintenance_mode 0 --input-format=integer sudo -u $app env PATH=$PATH drush @$app.prod state:set system.maintenance_mode 0 --input-format=integer