From c8679f3ed2c82c9315f2f8d0c2ba914717b5c3d4 Mon Sep 17 00:00:00 2001 From: Florian Schaal <florian@schaal-24.de> Date: Sat, 14 Nov 2015 11:11:32 -0500 Subject: [PATCH] FS#4031 - Disabling server option "Network Filesystem" does not work --- server/plugins-available/nginx_plugin.inc.php | 33 +++++++++++++++++++++++---------- 1 files changed, 23 insertions(+), 10 deletions(-) diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 9ce9de8..7bb4f8c 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -475,7 +475,8 @@ } //* Unmount the old log directory bfore we move the log dir - exec('umount '.escapeshellcmd($old_dir.'/log')); + //exec('fuser -km '.escapeshellcmd($old_dir.'/log')); + exec('umount '.escapeshellcmd($data['old']['document_root'].'/log')); //* Create new base directory, if it does not exist yet if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir); @@ -557,6 +558,7 @@ $app->system->removeLine('/etc/fstab', $fstab_line); //* Unmount log directory + //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder)); exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$old_log_folder)); } @@ -570,7 +572,8 @@ $app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755); exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); //* add mountpoint to fstab - $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0'; + $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait'; + $fstab_line .= @($web_config['network_filesystem'] == 'y')?',_netdev 0 0':' 0 0'; $app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1); } @@ -950,7 +953,7 @@ $default_php_fpm = true; } */ - if($data['new']['php'] != 'no'){ + if($data['new']['php'] == 'php-fpm'){ if(trim($data['new']['fastcgi_php_version']) != ''){ $default_php_fpm = false; list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); @@ -1880,10 +1883,12 @@ if(is_array($log_folders) && !empty($log_folders)){ foreach($log_folders as $log_folder){ //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); + //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); } } else { //if($app->system->is_mounted($data['old']['document_root'].'/'.$log_folder)) exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder)); + //exec('fuser -km '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null'); } } @@ -2424,9 +2429,12 @@ exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1'); exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' restart >/dev/null 2>&1'); - $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); - file_put_contents('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'], $monit_content); - exec('/etc/init.d/monit restart >/dev/null 2>&1'); + if(is_dir('/etc/monit/conf.d')){ + $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); + file_put_contents('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'], $monit_content); + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])) unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + exec('/etc/init.d/monit restart >/dev/null 2>&1'); + } } elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') { exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); @@ -2434,8 +2442,13 @@ unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); - if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ - unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ + unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + } + if(is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ + unlink('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user']); + } exec('/etc/init.d/monit restart >/dev/null 2>&1'); } } @@ -2454,7 +2467,7 @@ $default_php_fpm = true; } */ - if($data['new']['php'] != 'no'){ + if($data['new']['php'] == 'php-fpm'){ if(trim($data['new']['fastcgi_php_version']) != ''){ $default_php_fpm = false; list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); @@ -2475,7 +2488,7 @@ $app->uses("getconf"); $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); - if($data['new']['php'] == 'no'){ + if($data['new']['php'] != 'php-fpm'){ if(@is_file($pool_dir.$pool_name.'.conf')){ $app->system->unlink($pool_dir.$pool_name.'.conf'); //$reload = true; -- Gitblit v1.9.1