From 80e338610f2aa3a7b452603b2e5b4b6915c35007 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Fri, 3 Dec 2010 10:41:12 +0000 Subject: [PATCH] don't allow activation of FCGID and PHP-FPM at the same time --- actions/admin/settings/135.fcgid.php | 1 + actions/admin/settings/136.phpfpm.php | 1 + .../validate/function.checkFcgidPhpFpm.php | 44 +++++++++++++++++++ lng/english.lng.php | 2 + lng/german.lng.php | 2 + 5 files changed, 50 insertions(+) create mode 100644 lib/functions/validate/function.checkFcgidPhpFpm.php diff --git a/actions/admin/settings/135.fcgid.php b/actions/admin/settings/135.fcgid.php index ed828480..1942a76b 100644 --- a/actions/admin/settings/135.fcgid.php +++ b/actions/admin/settings/135.fcgid.php @@ -28,6 +28,7 @@ return array( 'type' => 'bool', 'default' => false, 'save_method' => 'storeSettingField', + 'plausibility_check_method' => 'checkFcgidPhpFpm', 'overview_option' => true ), 'system_mod_fcgid_configdir' => array( diff --git a/actions/admin/settings/136.phpfpm.php b/actions/admin/settings/136.phpfpm.php index 4d18383b..d8de4fd1 100644 --- a/actions/admin/settings/136.phpfpm.php +++ b/actions/admin/settings/136.phpfpm.php @@ -27,6 +27,7 @@ return array( 'type' => 'bool', 'default' => false, 'save_method' => 'storeSettingField', + 'plausibility_check_method' => 'checkFcgidPhpFpm', 'overview_option' => true ), 'system_phpfpm_configdir' => array( diff --git a/lib/functions/validate/function.checkFcgidPhpFpm.php b/lib/functions/validate/function.checkFcgidPhpFpm.php new file mode 100644 index 00000000..594c7c3c --- /dev/null +++ b/lib/functions/validate/function.checkFcgidPhpFpm.php @@ -0,0 +1,44 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Functions + * @version $Id$ + */ + +function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) +{ + global $settings; + + $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); + + /* + * check whether fcgid should be enabled but php-fpm is + */ + if($fieldname == 'system_mod_fcgid_enabled' + && (int)$newfieldvalue == 1 + && (int)$settings['phpfpm']['enabled'] == 1 + ) { + $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'phpfpmstillenabled'); + } + /* + * check whether php-fpm should be enabled but fcgid is + */ + elseif($fieldname == 'system_phpfpm_enabled' + && (int)$newfieldvalue == 1 + && (int)$settings['system']['mod_fcgid'] == 1 + ) { + $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled'); + } + + return $returnvalue; +} diff --git a/lng/english.lng.php b/lng/english.lng.php index 7ac37e3f..927a5c35 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1541,3 +1541,5 @@ $lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'] = 'The d $lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'] = 'Note: Used only when pm is set to \'dynamic\'
Note: Mandatory when pm is set to \'dynamic\''; $lng['serversettings']['phpfpm_settings']['max_requests']['title'] = 'Requests per child before respawning'; $lng['serversettings']['phpfpm_settings']['max_requests']['description'] = 'For endless request processing specify \'0\'. Equivalent to PHP_FCGI_MAX_REQUESTS.'; +$lng['error']['phpfpmstillenabled'] = 'PHP-FPM is currently active. Please deactivate it before activating FCGID'; +$lng['error']['fcgidstillenabled'] = 'FCGID is currently active. Please deactivate it before activating PHP-FPM'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 80631d41..c7f471d7 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1523,3 +1523,5 @@ $lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'] = 'Maxim $lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'] = 'Hinweis: Nur wenn PM auf \'dynamic\' steht
Wichtig: Pflichtangabe wenn PM auf \'dynamic\' steht'; $lng['serversettings']['phpfpm_settings']['max_requests']['title'] = 'Requests pro Kindprozess bevor Neuerstellung (respawning)'; $lng['serversettings']['phpfpm_settings']['max_requests']['description'] = 'Für keine Begrenzung \'0\' angeben. Equivalent zu PHP_FCGI_MAX_REQUESTS.'; +$lng['error']['phpfpmstillenabled'] = 'PHP-FPM ist derzeit aktiviert. Bitte deaktiviere es, um FCGID zu aktivieren'; +$lng['error']['fcgidstillenabled'] = 'FCGID ist derzeit aktiviert. Bitte deaktiviere es, um PHP-FPM zu aktivieren';