Skip to content

Commit 837d183

Browse files
author
mcramer
committed
Fix: web content and some other data of vhost subdomain did not get deleted on subdomain deletion
1 parent 3cde193 commit 837d183

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,7 @@ function delete($event_name,$data) {
14631463

14641464
//* Remove the mounts
14651465
$log_folder = 'log';
1466+
$web_folder = '';
14661467
if($data['old']['type'] == 'vhostsubdomain') {
14671468
$tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
14681469
$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
@@ -1516,9 +1517,12 @@ function delete($event_name,$data) {
15161517
$app->system->unlink($vhost_file);
15171518
$app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
15181519

1519-
if($data['old']['type'] == 'vhost') {
1520+
if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
15201521
$docroot = escapeshellcmd($data['old']['document_root']);
1521-
if($docroot != '' && !stristr($docroot,'..')) exec('rm -rf '.$docroot);
1522+
if($docroot != '' && !stristr($docroot,'..')) {
1523+
if($data['old']['type'] == 'vhost') exec('rm -rf '.$docroot);
1524+
elseif(!stristr($data['old']['web_folder'], '..')) exec('rm -rf '.$docroot.'/'.$web_folder;
1525+
}
15221526

15231527
//remove the php fastgi starter script if available
15241528
if ($data['old']['php'] == 'fast-cgi') {
@@ -1579,8 +1583,6 @@ function delete($event_name,$data) {
15791583
}
15801584
}
15811585
// end removing symlinks
1582-
} else {
1583-
// vhost subdomain
15841586
}
15851587

15861588
// Delete the log file directory

server/plugins-available/nginx_plugin.inc.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,9 +1310,12 @@ function delete($event_name,$data) {
13101310
$app->system->unlink($vhost_file);
13111311
$app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
13121312

1313-
if($data['old']['type'] == 'vhost') {
1313+
if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
13141314
$docroot = escapeshellcmd($data['old']['document_root']);
1315-
if($docroot != '' && !stristr($docroot,'..')) exec('rm -rf '.$docroot);
1315+
if($docroot != '' && !stristr($docroot,'..')) {
1316+
if($data['old']['type'] == 'vhost') exec('rm -rf '.$docroot);
1317+
elseif(!stristr($data['old']['web_folder'], '..')) exec('rm -rf '.$docroot.'/'.$web_folder;
1318+
}
13161319

13171320
//remove the php fastgi starter script if available
13181321
if ($data['old']['php'] == 'fast-cgi') {

0 commit comments

Comments
 (0)