From b553b2bf146cf20bd3ddfeba52ec5cc5b70a1da9 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 27 Nov 2014 02:31:46 -0500
Subject: [PATCH] Merge remote-tracking branch 'ispc/master' into new-layout-3.1
---
server/plugins-available/nginx_plugin.inc.php | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 77ac10a..57044ef 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -2046,6 +2046,28 @@
$this->awstats_delete($data, $web_config);
}
+ //* Delete the web-backups
+ if($data['old']['type'] == 'vhost') {
+ $server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
+ $backup_dir = $server_config['backup_dir'];
+ $mount_backup = true;
+ if($server_config['backup_dir'] != '' && $server_config['backup_delete'] == 'y') {
+ //* mount backup directory, if necessary
+ if( $server_config['backup_dir_is_mount'] == 'y' && !$app->system->mount_backup_dir($backup_dir) ) $mount_backup = false;
+ if($mount_backup){
+ $web_backup_dir = $backup_dir.'/web'.$data_old['domain_id'];
+ //** do not use rm -rf $web_backup_dir because database(s) may exits
+ exec(escapeshellcmd('rm -f '.$web_backup_dir.'/web'.$data_old['domain_id'].'_').'*');
+ //* cleanup database
+ $sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename LIKE ?";
+ $app->db->query($sql, $conf['server_id'], $data_old['domain_id'], "web".$data_old['domain_id']."_%");
+ if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $data_old['domain_id'], "web".$data_old['domain_id']."_%");
+
+ $app->log('Deleted the web backup files', LOGLEVEL_DEBUG);
+ }
+ }
+ }
+
$app->services->restartServiceDelayed('httpd', 'reload');
}
--
Gitblit v1.9.1