From 4381eff384a3e2bd3026011167d22ac45d381f89 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Wed, 27 Nov 2013 08:34:49 +0100 Subject: [PATCH] check for fcgid being enabled when switching the webserver as only apache2 can handle fcgid (prevent a possible deadlock in the panel) Signed-off-by: Michael Kaufmann (d00p) --- actions/admin/settings/130.webserver.php | 1 + .../function.checkPhpInterfaceSetting.php | 33 +++++++++++++++++++ lng/english.lng.php | 1 + lng/german.lng.php | 1 + 4 files changed, 36 insertions(+) create mode 100644 lib/functions/validate/function.checkPhpInterfaceSetting.php diff --git a/actions/admin/settings/130.webserver.php b/actions/admin/settings/130.webserver.php index a2a49ad3..34da320a 100644 --- a/actions/admin/settings/130.webserver.php +++ b/actions/admin/settings/130.webserver.php @@ -31,6 +31,7 @@ return array( 'option_mode' => 'one', 'option_options' => array('apache2' => 'Apache 2', 'lighttpd' => 'ligHTTPd', 'nginx' => 'Nginx'), 'save_method' => 'storeSettingField', + 'plausibility_check_method' => 'checkPhpInterfaceSetting', 'overview_option' => true ), 'system_apache_24' => array( diff --git a/lib/functions/validate/function.checkPhpInterfaceSetting.php b/lib/functions/validate/function.checkPhpInterfaceSetting.php new file mode 100644 index 00000000..2e5d4892 --- /dev/null +++ b/lib/functions/validate/function.checkPhpInterfaceSetting.php @@ -0,0 +1,33 @@ + + * @author Froxlor team (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package AJAX + * + */ + +function checkPhpInterfaceSetting($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { + + global $settings; + + $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); + + if ((int)$settings['system']['mod_fcgid'] == 1) { + // now check if we enable a webserver != apache + if (strtolower($newfieldvalue) != 'apache2') { + $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenableddeadlock'); + } + } + + return $returnvalue; +} diff --git a/lng/english.lng.php b/lng/english.lng.php index ec0f9e0f..609c6944 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1978,3 +1978,4 @@ $lng['serversettings']['phpfpm_settings']['ipcdir']['title'] = 'FastCGI IPC dire $lng['serversettings']['phpfpm_settings']['ipcdir']['description'] = 'The directory where the php-fpm sockets will be stored by the webserver.
This directory has to be readable for the webserver'; $lng['panel']['news'] = 'News'; $lng['error']['sslredirectonlypossiblewithsslipport'] = 'Using the SSL redirect is only possible when the domain has at least one ssl-enabled IP/port combination assigned.'; +$lng['error']['fcgidstillenableddeadlock'] = 'FCGID is currently active.
Please deactivate it before switching to another webserver then Apache2'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 0c1ea1c2..796fcf6f 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1704,3 +1704,4 @@ $lng['serversettings']['phpfpm_settings']['ipcdir']['title'] = 'FastCGI IPC Verz $lng['serversettings']['phpfpm_settings']['ipcdir']['description'] = 'In dieses Verzeichnis werden die php-fpm Sockets vom Webserver abgelegt.
Das Verzeichnis muss für den Webserver lesbar sein.'; $lng['panel']['news'] = 'Neuigkeiten'; $lng['error']['sslredirectonlypossiblewithsslipport'] = 'Eine SSL-Weiterleitung ist nur möglich, wenn der Domain mindestens eine IP/Port Kombination zugewiesen wurde, bei der SSL aktiviert ist.'; +$lng['error']['fcgidstillenableddeadlock'] = 'FCGID ist derzeit aktiviert.
Bitte deaktiviere es, um einen anderen Webserver als Apache2 auswählen zu können.';