From d01cb9826ab6efd8ba4bd882f58eb40b7b299afe Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 16 Dec 2020 15:38:07 +0100 Subject: [PATCH 1/3] Upgrade php version --- scripts/upgrade | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index cf4cfd8..c85d5fe 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -147,12 +147,23 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 +# If php has changed, remove the old fpm config file +if [ "$phpversion" != $YNH_PHP_VERSION ] +then + ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" + ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" + ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload + ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" + + phpversion="$YNH_PHP_VERSION" +fi + # Recreate a dedicated PHP-FPM config ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/$phpversion/fpm/conf.d/20-$app.ini + ynh_secure_remove --file=/etc/php/$phpversion/fpm/conf.d/20-$app.ini fi #================================================= From 001a2b6a1a15eddc98346de48f8c10228d0ba122 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 16 Dec 2020 16:16:34 +0100 Subject: [PATCH 2/3] reload php-fpm --- scripts/upgrade | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index c85d5fe..a1aeb06 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -153,7 +153,9 @@ then ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload - ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" + if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then + ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" + fi phpversion="$YNH_PHP_VERSION" fi @@ -478,9 +480,10 @@ ynh_app_setting_set --app=$app --key=skipped_regex \ #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload #================================================= # FINISH MIGRATION PROCESS From 9f056198d512447502acdf94ea20d8721cf0fbb1 Mon Sep 17 00:00:00 2001 From: Kayou Date: Thu, 17 Dec 2020 12:00:56 +0100 Subject: [PATCH 3/3] Apply suggestions from code review --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a1aeb06..8c07855 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -152,11 +152,11 @@ if [ "$phpversion" != $YNH_PHP_VERSION ] then ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" - ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" fi - + ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload + phpversion="$YNH_PHP_VERSION" fi