Skip to content

Commit a080b1c

Browse files
committed
simplify redhat os detection for the Nginx EL workaround
1 parent 7fa44a0 commit a080b1c

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

server/lib/classes/system.inc.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,6 +2327,16 @@ public function is_allowed_group($groupname, $check_id = true, $restrict_names =
23272327
return true;
23282328
}
23292329

2330+
public function is_redhat_os() {
2331+
global $app;
2332+
2333+
if(file_exists('/etc/redhat-release') && (filesize('/etc/redhat-release') > 0)) {
2334+
return true;
2335+
} else {
2336+
return false;
2337+
}
2338+
}
2339+
23302340
public function is_allowed_path($path) {
23312341
global $app;
23322342

server/plugins-available/nginx_plugin.inc.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,6 @@ private function hhvm_update($data, $web_config) {
28522852
private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir, $web_folder = null) {
28532853
global $app, $conf;
28542854
$pool_dir = trim($pool_dir);
2855-
$rh_releasefiles = array('/etc/centos-release', '/etc/redhat-release');
28562855

28572856
// HHVM => PHP-FPM-Fallback
28582857
$default_php_fpm = true;
@@ -2923,21 +2922,14 @@ private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name,
29232922
$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
29242923
$tpl->setVar('fpm_user', $data['new']['system_user']);
29252924

2926-
//Red Hat workaround for group ownership of socket files
2927-
foreach($rh_releasefiles as $rh_file) {
2928-
if(file_exists($rh_file) && (filesize($rh_file) > 0)) {
2929-
$tmp = file_get_contents($rh_file);
2930-
if(preg_match('/[678]+\.[0-9]+/m', $tmp)) {
2931-
$tpl->setVar('fpm_group', $data['new']['system_group']);
2932-
$tpl->setVar('fpm_listen_group', $data['new']['system_group']);
2933-
}
2934-
unset($tmp);
2935-
} elseif(!file_exists($rh_file)) {
2936-
//OS seems to be not Red Hat'ish
2937-
$tpl->setVar('fpm_group', $data['new']['system_group']);
2938-
$tpl->setVar('fpm_listen_group', $web_config['group']);
2939-
}
2940-
break;
2925+
// RH workaround here
2926+
if($app->system->is_redhat_os() == 1) {
2927+
$tpl->setVar('fpm_group', $data['new']['system_group']);
2928+
$tpl->setVar('fpm_listen_group', $data['new']['system_group']);
2929+
} else {
2930+
//OS seems to be not Red Hat'ish
2931+
$tpl->setVar('fpm_group', $data['new']['system_group']);
2932+
$tpl->setVar('fpm_listen_group', $web_config['group']);
29412933
}
29422934

29432935
$tpl->setVar('fpm_listen_user', $data['new']['system_user']);

0 commit comments

Comments
 (0)