mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-22 02:47:34 +00:00
do not allow to enable fcgid/fpm at the same time when both are set to 'yes' simultaneously in settings
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
parent
77ae3aa387
commit
f4dff676d6
@ -14,25 +14,49 @@
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||
|
||||
$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::Get('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::Get('system.mod_fcgid') == 1
|
||||
) {
|
||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled');
|
||||
}
|
||||
|
||||
return $returnvalue;
|
||||
function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
||||
{
|
||||
$returnvalue = array(
|
||||
FORMFIELDS_PLAUSIBILITY_CHECK_OK
|
||||
);
|
||||
|
||||
$check_array = array(
|
||||
'system_mod_fcgid_enabled' => array(
|
||||
'other_post_field' => 'system_phpfpm_enabled',
|
||||
'other_enabled' => 'phpfpm.enabled',
|
||||
'other_enabled_lng' => 'phpfpmstillenabled'
|
||||
),
|
||||
'system_phpfpm_enabled' => array(
|
||||
'other_post_field' => 'system_mod_fcgid_enabled',
|
||||
'other_enabled' => 'system.mod_fcgid',
|
||||
'other_enabled_lng' => 'fcgidstillenabled'
|
||||
)
|
||||
);
|
||||
|
||||
// interface is to be enabled
|
||||
if ((int) $newfieldvalue == 1) {
|
||||
// check for POST value of the other field == 1 (active)
|
||||
if (isset($_POST[$check_array[$fieldname]['other_post_field']]) && (int) $_POST[$check_array[$fieldname]['other_post_field']] == 1) {
|
||||
// the other interface is activated already and STAYS activated
|
||||
if ((int) Settings::Get($check_array[$fieldname]['other_enabled']) == 1) {
|
||||
$returnvalue = array(
|
||||
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
|
||||
$check_array[$fieldname]['other_enabled_lng']
|
||||
);
|
||||
} else {
|
||||
// fcgid is being validated before fpm -> "ask" fpm about its state
|
||||
if ($fieldname == 'system_mod_fcgid_enabled') {
|
||||
$returnvalue = checkFcgidPhpFpm('system_phpfpm_enabled', null, $check_array[$fieldname]['other_post_field'], null);
|
||||
} else {
|
||||
// not, bot are nogo
|
||||
$returnvalue = $returnvalue = array(
|
||||
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
|
||||
'fcgidandphpfpmnogoodtogether'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $returnvalue;
|
||||
}
|
||||
|
@ -1838,3 +1838,4 @@ $lng['usersettings']['custom_notes']['description'] = 'Feel free to put any note
|
||||
$lng['usersettings']['custom_notes']['show'] = 'Show your notes on the dashboard of the user';
|
||||
$lng['serversettings']['system_send_cron_errors']['title'] = 'Send cron-errors to froxlor-admin via e-mail';
|
||||
$lng['serversettings']['system_send_cron_errors']['description'] = 'Chose whether you want to receive an e-mail on cronjob errors. Keep in mind that this can lead to an e-mail being sent every 5 minutes depending on the error and your cronjob settings.';
|
||||
$lng['error']['fcgidandphpfpmnogoodtogether'] = 'FCGID and PHP-FPM cannot be activated at the same time';
|
||||
|
@ -1565,3 +1565,4 @@ $lng['usersettings']['custom_notes']['description'] = 'Hier können Notizen je n
|
||||
$lng['usersettings']['custom_notes']['show'] = 'Zeige die Notizen auf dem Dashboard des Benutzers';
|
||||
$lng['serversettings']['system_send_cron_errors']['title'] = 'Sende Cron-Fehler via E-Mail an den Froxlor-Admin';
|
||||
$lng['serversettings']['system_send_cron_errors']['description'] = 'Gib an, ob bei einem Cron-Fehler eine E-Mail versendet werden soll. Beachte das es je nach Fehler und Cronjob-Einstellungen dazu kommen kann, dass diese E-Mail alle 5 Minuten gesendet wird.';
|
||||
$lng['error']['fcgidandphpfpmnogoodtogether'] = 'FCGID und PHP-FPM können nicht gleichzeitig aktiviert werden.';
|
||||
|
Loading…
Reference in New Issue
Block a user