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

Upgrading to PHP7.3

Fix #20
This commit is contained in:
yalh76 2020-03-18 02:06:30 +01:00
parent d4592600ca
commit 9a5281a194
7 changed files with 51 additions and 24 deletions

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

@ -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)" = "stretch" ]; then
ynh_print_info --message="Installing PHP7.3..."
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
else
pkg_dependencies="$pkg_dependencies $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
#================================================= #=================================================
@ -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

@ -81,6 +81,17 @@ chown -R $app: $final_path
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#=================================================
# REINSTALL PHP7.3
#=================================================
if [ "$(lsb_release --codename --short)" = "stretch" ]; then
ynh_print_info --message="Reinstalling PHP7.3..."
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
else
pkg_dependencies="$pkg_dependencies $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
@ -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,23 @@ 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)" = "stretch" ]; then
ynh_print_info --message="Upgrading PHP7.3..."
ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies"
else
pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies"
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
@ -106,8 +116,11 @@ 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..."
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
# 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
@ -123,8 +136,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 +155,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