Till Brehm
2014-07-27 3fb802e577d71b66b9aec5593b687bcd4859581e
Fixed: FS#3509 - Apache log directory not unmounted when moving site
2 files modified
10 ■■■■■ changed files
server/plugins-available/apache2_plugin.inc.php 5 ●●●●● patch | view | raw | blame | history
server/plugins-available/nginx_plugin.inc.php 5 ●●●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php
@@ -461,6 +461,9 @@
                    $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 @@
            $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));
        }
server/plugins-available/nginx_plugin.inc.php
@@ -465,6 +465,9 @@
                    $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 @@
            $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));
        }