Skip to content

Commit 3cde193

Browse files
committed
Ensure that folder protection is deactivated for the path of the base website when deleting a vhostsubdomain.
1 parent a39c363 commit 3cde193

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,13 +1464,17 @@ function delete($event_name,$data) {
14641464
//* Remove the mounts
14651465
$log_folder = 'log';
14661466
if($data['old']['type'] == 'vhostsubdomain') {
1467-
$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
1467+
$tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
14681468
$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
14691469
if($subdomain_host == '') $subdomain_host = 'web'.$data['old']['domain_id'];
14701470
$web_folder = $data['old']['web_folder'];
14711471
$log_folder .= '/' . $subdomain_host;
1472+
$parent_web_document_root = $tmp['document_root'];
1473+
$app->system->web_folder_protection($parent_web_document_root,false);
14721474
unset($tmp);
1473-
}
1475+
} else {
1476+
$app->system->web_folder_protection($data['old']['document_root'],false);
1477+
}
14741478

14751479
exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
14761480

@@ -1598,6 +1602,10 @@ function delete($event_name,$data) {
15981602
$this->awstats_delete($data,$web_config);
15991603
}
16001604

1605+
if($data['old']['type'] == 'vhostsubdomain') {
1606+
$app->system->web_folder_protection($parent_web_document_root,true);
1607+
}
1608+
16011609
if($apache_chrooted) {
16021610
$app->services->restartServiceDelayed('httpd','restart');
16031611
} else {

0 commit comments

Comments
 (0)