From e7e9a52551103099a00de25c0aab6ff68a540c9b Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Fri, 20 Sep 2013 14:10:54 -0400
Subject: [PATCH] - Remove non-existing backups from web_backup table.
---
server/cron_daily.php | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 7793bb2..3342cee 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -1194,7 +1194,6 @@
}
$app->system->web_folder_protection($web_path,true);
-
}
/* If backup_interval is set to none and we have a
@@ -1296,6 +1295,19 @@
unset($clientdb_password);
}
+
+ // remove non-existing backups from database
+ $backups = $app->db->queryAllRecords("SELECT * FROM web_backup WHERE server_id = ".$conf['server_id']);
+ if(is_array($backups) && !empty($backups)){
+ foreach($backups as $backup){
+ $backup_file = $backup_dir.'/web'.$backup['parent_domain_id'].'/'.$backup['filename'];
+ if(!is_file($backup_file)){
+ $sql = "DELETE FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = ".$backup['parent_domain_id']." AND filename = '".$backup['filename']."'";
+ $app->db->query($sql);
+ if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+ }
+ }
+ }
}
--
Gitblit v1.9.1