From 86c833863a6febca1f1bd4c8408239853ed3acfb Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 9 Jan 2016 12:14:24 -0500 Subject: Consolidate all of the set_foo() functions. --- src/php.eselect.in | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/php.eselect.in b/src/php.eselect.in index 8f752e4..9970520 100644 --- a/src/php.eselect.in +++ b/src/php.eselect.in @@ -463,6 +463,9 @@ set_sapi() { # configuration with -DPHP5 and 70_mod_php5.conf. If he is, warn him # that it is outdated, and that his eselect choices will not have any # effect until the configuration is updated. +# +# This can be removed after around a year. +# apache2_php5_config_check() { if [ -f "${EROOT}/etc/apache2/modules.d/70_mod_php5.conf" ] ; then local msg @@ -478,31 +481,6 @@ apache2_php5_config_check() { fi } -set_apache2() { - apache2_php5_config_check - local target="${1}" - set_sapi apache2 "${target}" - write_mod_php_conf "$(resolv_target apache2 "${target}")" - echo "Please restart apache for the changes to take effect." -} - -set_cli() { - set_sapi cli "${1}" -} - -set_cgi() { - set_sapi cgi "${1}" -} - -set_phpdbg() { - set_sapi phpdbg "${1}" -} - -set_fpm() { - set_sapi fpm "${1}" - echo "Please restart php-fpm for the changes to take effect." -} - ## set action describe_set() { @@ -520,8 +498,19 @@ describe_set_options() { do_set() { - check_module $1 - set_$1 $2 + local sapi="${1}" + local target="${2}" + check_module "${sapi}" + + set_sapi "${sapi}" "${target}" + + if [[ "${sapi}" == "apache2" ]]; then + apache2_php5_config_check + write_mod_php_conf "$(resolv_target apache2 "${target}")" + echo "Please restart apache for the changes to take effect." + elif [[ "${sapi}" == "fpm" ]]; then + echo "Please restart php-fpm for the changes to take effect." + fi } -- cgit v1.2.3-65-gdbad