From 3fb802e577d71b66b9aec5593b687bcd4859581e Mon Sep 17 00:00:00 2001 From: Till Brehm <tbrehm@ispconfig.org> Date: Sun, 27 Jul 2014 21:24:15 +0200 Subject: [PATCH] Fixed: FS#3509 - Apache log directory not unmounted when moving site --- server/plugins-available/apache2_plugin.inc.php | 5 +++++ server/plugins-available/nginx_plugin.inc.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index cbda9f67c3..addcd138b8 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -461,6 +461,9 @@ class apache2_plugin { $app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s')); $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG); } + + //* Unmount the old log directory bfore we move the log dir + exec('umount '.escapeshellcmd($old_dir.'/log')); //* Create new base directory, if it does not exist yet if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir); @@ -492,6 +495,8 @@ class apache2_plugin { $app->system->removeLine('/etc/fstab', $fstab_line); $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0'; $app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1); + + exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); } diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 1947367c9a..d83ecf442f 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -465,6 +465,9 @@ class nginx_plugin { $app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s')); $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG); } + + //* Unmount the old log directory bfore we move the log dir + exec('umount '.escapeshellcmd($old_dir.'/log')); //* Create new base directory, if it does not exist yet if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir); @@ -496,6 +499,8 @@ class nginx_plugin { $app->system->removeLine('/etc/fstab', $fstab_line); $fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.' none bind,nobootwait,_netdev 0 0'; $app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1); + + exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder)); } -- GitLab