Skip to content

Commit fea5e7c

Browse files
committed
Added unmount commands when website gets deleted in apache2_plugin.inc.php
1 parent 58053ea commit fea5e7c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,23 @@ function delete($event_name,$data) {
14601460
} else {
14611461
$apache_chrooted = false;
14621462
}
1463+
1464+
//* Remove the mounts
1465+
$log_folder = 'log';
1466+
if($data['old']['type'] == 'vhostsubdomain') {
1467+
$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
1468+
$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
1469+
if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id'];
1470+
$web_folder = $data['old']['web_folder'];
1471+
$log_folder .= '/' . $subdomain_host;
1472+
unset($tmp);
1473+
}
1474+
1475+
exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
1476+
1477+
//* remove mountpoint from fstab
1478+
$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.' none bind 0 0';
1479+
$app->system->removeLine('/etc/fstab',$fstab_line);
14631480

14641481
if($data['old']['type'] != 'vhost' && $data['old']['type'] != 'vhostsubdomain' && $data['old']['parent_domain_id'] > 0) {
14651482
//* This is a alias domain or subdomain, so we have to update the website instead

0 commit comments

Comments
 (0)