Skip to content

Commit ec77608

Browse files
committed
- Renamed PHP-FPM pool files from {domain}.conf to web{domain_id}.conf.
1 parent 6e558a9 commit ec77608

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

server/plugins-available/nginx_plugin.inc.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,25 +1077,22 @@ private function php_fpm_pool_update ($data,$web_config) {
10771077
global $app, $conf;
10781078

10791079
$pool_dir = $web_config['php_fpm_pool_dir'];
1080+
$pool_name = 'web'.$data['new']['domain_id'];
10801081
//$reload = false;
10811082

10821083
if($data['new']['php'] == 'no'){
1083-
if(@is_file($pool_dir.'/'.$data['old']['domain'].'.conf')){
1084-
unlink($pool_dir.'/'.$data['old']['domain'].'.conf');
1085-
//$reload = true;
1086-
}
1087-
if(@is_file($pool_dir.'/'.$data['new']['domain'].'.conf')){
1088-
unlink($pool_dir.'/'.$data['new']['domain'].'.conf');
1084+
if(@is_file($pool_dir.'/'.$pool_name.'.conf')){
1085+
unlink($pool_dir.'/'.$pool_name.'.conf');
10891086
//$reload = true;
10901087
}
10911088
//if($reload == true) $app->services->restartService('php-fpm','reload');
10921089
return;
10931090
}
10941091

10951092
//if(!@is_file($pool_dir.'/'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
1096-
if ( @is_file($pool_dir.'/'.$data['old']['domain'].'.conf') ) {
1097-
unlink($pool_dir.'/'.$data['old']['domain'].'.conf');
1098-
}
1093+
//if ( @is_file($pool_dir.'/'.$pool_name.'.conf') ) {
1094+
// unlink($pool_dir.'/'.$pool_name.'.conf');
1095+
//}
10991096

11001097
$app->uses("getconf");
11011098
$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
@@ -1104,7 +1101,7 @@ private function php_fpm_pool_update ($data,$web_config) {
11041101
$tpl = new tpl();
11051102
$tpl->newTemplate('php_fpm_pool.conf.master');
11061103

1107-
$tpl->setVar('fpm_pool', $data['new']['domain']);
1104+
$tpl->setVar('fpm_pool', $pool_name);
11081105
$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] + 1);
11091106
$tpl->setVar('fpm_user', $data['new']['system_user']);
11101107
$tpl->setVar('fpm_group', $data['new']['system_group']);
@@ -1154,8 +1151,8 @@ private function php_fpm_pool_update ($data,$web_config) {
11541151

11551152
$tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
11561153

1157-
file_put_contents($pool_dir.'/'.$data['new']['domain'].'.conf',$tpl->grab());
1158-
$app->log('Writing the PHP-FPM config file: '.$pool_dir.'/'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);
1154+
file_put_contents($pool_dir.'/'.$pool_name.'.conf',$tpl->grab());
1155+
$app->log('Writing the PHP-FPM config file: '.$pool_dir.'/'.$pool_name.'.conf',LOGLEVEL_DEBUG);
11591156
unset($tpl);
11601157
//$reload = true;
11611158
//}
@@ -1167,11 +1164,12 @@ private function php_fpm_pool_delete ($data,$web_config) {
11671164
global $app;
11681165

11691166
$pool_dir = $web_config['php_fpm_pool_dir'];
1167+
$pool_name = 'web'.$data['old']['domain_id'];
11701168

1171-
if ( @is_file($pool_dir.'/'.$data['old']['domain'].'.conf') ) {
1172-
unlink($pool_dir.'/'.$data['old']['domain'].'.conf');
1173-
$app->log('Removed PHP-FPM config file: '.$pool_dir.'/'.$data['old']['domain'].'.conf',LOGLEVEL_DEBUG);
1174-
$app->services->restartService('php-fpm','reload');
1169+
if ( @is_file($pool_dir.'/'.$pool_name.'.conf') ) {
1170+
unlink($pool_dir.'/'.$pool_name.'.conf');
1171+
$app->log('Removed PHP-FPM config file: '.$pool_dir.'/'.$pool_name.'.conf',LOGLEVEL_DEBUG);
1172+
//$app->services->restartService('php-fpm','reload');
11751173
}
11761174
}
11771175

0 commit comments

Comments
 (0)