|
14 | 14 | * @package Functions
|
15 | 15 | *
|
16 | 16 | */
|
17 |
| - |
18 |
| -function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { |
19 |
| - |
20 |
| - $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); |
21 |
| - |
22 |
| - // check whether fcgid should be enabled but php-fpm is |
23 |
| - if($fieldname == 'system_mod_fcgid_enabled' |
24 |
| - && (int)$newfieldvalue == 1 |
25 |
| - && (int)Settings::Get('phpfpm.enabled') == 1 |
26 |
| - ) { |
27 |
| - $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'phpfpmstillenabled'); |
28 |
| - } |
29 |
| - // check whether php-fpm should be enabled but fcgid is |
30 |
| - elseif($fieldname == 'system_phpfpm_enabled' |
31 |
| - && (int)$newfieldvalue == 1 |
32 |
| - && (int)Settings::Get('system.mod_fcgid') == 1 |
33 |
| - ) { |
34 |
| - $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled'); |
35 |
| - } |
36 |
| - |
37 |
| - return $returnvalue; |
| 17 | +function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) |
| 18 | +{ |
| 19 | + $returnvalue = array( |
| 20 | + FORMFIELDS_PLAUSIBILITY_CHECK_OK |
| 21 | + ); |
| 22 | + |
| 23 | + $check_array = array( |
| 24 | + 'system_mod_fcgid_enabled' => array( |
| 25 | + 'other_post_field' => 'system_phpfpm_enabled', |
| 26 | + 'other_enabled' => 'phpfpm.enabled', |
| 27 | + 'other_enabled_lng' => 'phpfpmstillenabled' |
| 28 | + ), |
| 29 | + 'system_phpfpm_enabled' => array( |
| 30 | + 'other_post_field' => 'system_mod_fcgid_enabled', |
| 31 | + 'other_enabled' => 'system.mod_fcgid', |
| 32 | + 'other_enabled_lng' => 'fcgidstillenabled' |
| 33 | + ) |
| 34 | + ); |
| 35 | + |
| 36 | + // interface is to be enabled |
| 37 | + if ((int) $newfieldvalue == 1) { |
| 38 | + // check for POST value of the other field == 1 (active) |
| 39 | + if (isset($_POST[$check_array[$fieldname]['other_post_field']]) && (int) $_POST[$check_array[$fieldname]['other_post_field']] == 1) { |
| 40 | + // the other interface is activated already and STAYS activated |
| 41 | + if ((int) Settings::Get($check_array[$fieldname]['other_enabled']) == 1) { |
| 42 | + $returnvalue = array( |
| 43 | + FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, |
| 44 | + $check_array[$fieldname]['other_enabled_lng'] |
| 45 | + ); |
| 46 | + } else { |
| 47 | + // fcgid is being validated before fpm -> "ask" fpm about its state |
| 48 | + if ($fieldname == 'system_mod_fcgid_enabled') { |
| 49 | + $returnvalue = checkFcgidPhpFpm('system_phpfpm_enabled', null, $check_array[$fieldname]['other_post_field'], null); |
| 50 | + } else { |
| 51 | + // not, bot are nogo |
| 52 | + $returnvalue = $returnvalue = array( |
| 53 | + FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, |
| 54 | + 'fcgidandphpfpmnogoodtogether' |
| 55 | + ); |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + return $returnvalue; |
38 | 62 | }
|
0 commit comments