From 017b0e929c7f6a07f7828013316da7fcc3fe80f5 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 10 Apr 2020 00:31:06 +0200 Subject: [PATCH] Use YNH_DEFAULT_PHP_VERSION instead of 7.0 --- data/helpers.d/php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/data/helpers.d/php b/data/helpers.d/php index 07bf5ab7c..29b9995d4 100644 --- a/data/helpers.d/php +++ b/data/helpers.d/php @@ -195,9 +195,9 @@ ynh_install_php () { # Store phpversion into the config of this app ynh_app_setting_set $app phpversion $phpversion - if [ "$phpversion" == "7.0" ] + if [ "$phpversion" == "$YNH_DEFAULT_PHP_VERSION" ] then - ynh_die "Do not use ynh_install_php to install php7.0" + ynh_die "Do not use ynh_install_php to install php$YNH_DEFAULT_PHP_VERSION" fi # Store the ID of this app and the version of php requested for it @@ -211,12 +211,12 @@ ynh_install_php () { ynh_add_app_dependencies --package="php${phpversion}-fpm" ynh_add_app_dependencies --package="php$phpversion php${phpversion}-common $package" - # Set php7.0 back as the default version for php-cli. - update-alternatives --set php /usr/bin/php7.0 + # Set the default php version back as the default version for php-cli. + update-alternatives --set php /usr/bin/php$YNH_DEFAULT_PHP_VERSION # Pin this extra repository after packages are installed to prevent sury of doing shit ynh_pin_repo --package="*" --pin="origin \"packages.sury.org\"" --priority=200 --name=extra_php_version - ynh_pin_repo --package="php7.0*" --pin="origin \"packages.sury.org\"" --priority=600 --name=extra_php_version --append + ynh_pin_repo --package="php${$YNH_DEFAULT_PHP_VERSION}*" --pin="origin \"packages.sury.org\"" --priority=600 --name=extra_php_version --append # Advertise service in admin panel yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" @@ -229,11 +229,11 @@ ynh_remove_php () { # Get the version of php used by this app local phpversion=$(ynh_app_setting_get $app phpversion) - if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ] + if [ "$phpversion" == "$YNH_DEFAULT_PHP_VERSION" ] || [ -z "$phpversion" ] then - if [ "$phpversion" == "7.0" ] + if [ "$phpversion" == "$YNH_DEFAULT_PHP_VERSION" ] then - ynh_print_err "Do not use ynh_remove_php to install php7.0" + ynh_print_err "Do not use ynh_remove_php to install php$YNH_DEFAULT_PHP_VERSION" fi return 0 fi