From 90345a544e80d7e7f00767c55499bd32c578143b Mon Sep 17 00:00:00 2001 From: Gofannon Date: Sun, 26 Feb 2023 18:03:38 +0100 Subject: [PATCH] Fix "php conf location" breaking backup script See https://github.com/YunoHost-Apps/dokuwiki_ynh/issues/96 the bug: > php file is still in folder: '/etc/php/7.4/fpm/pool.d/' after upgrade > instead of '8.1' folder. Changing the "ynh_add_fpm_config" for the fix. The helper should do the "php version handling" instead of the package itself Example taken on the package: https://github.com/YunoHost-Apps/wordpress_ynh/blob/testing/scripts/upgrade --- scripts/upgrade | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e86999f..2d9c457 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,6 +76,12 @@ if [ -z "$fpm_usage" ]; then ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi +# If phpversion doesn't exist, create it +if [ -z "$phpversion" ]; then + phpversion=$YNH_PHP_VERSION + ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion +fi + # Cleaning legacy permissions admin_user=$(ynh_app_setting_get --app=$app --key=admin) @@ -217,7 +223,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint #================================================= # NGINX CONFIGURATION @@ -299,7 +305,7 @@ fi # Stolen from https://github.com/YunoHost-Apps/grav_ynh/blob/testing/scripts/upgrade#L189 if [ -x "$final_path/bin/plugin.php" ]; then pushd "$final_path" - ynh_exec_warn_less ynh_exec_as $app php${YNH_PHP_VERSION} bin/plugin.php --no-colors extension upgrade || ynh_print_warn --message="Automatic plugin upgrade has failed, you can upgrade them from your DokuWiki admin panel." + ynh_exec_warn_less ynh_exec_as $app php$phpversion bin/plugin.php --no-colors extension upgrade || ynh_print_warn --message="Automatic plugin upgrade has failed, you can upgrade them from your DokuWiki admin panel." popd else ynh_print_warn --message="Automatic plugin cannot be done, you have to upgrade them from your DokuWiki admin panel."