summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-04-07 19:52:38 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-04-07 19:52:38 +0000
commit6ec72f51f2d0db3cad75718b976e378fd1fb0125 (patch)
treef8add2bedc007d9b79a783fe56d908764795a0bc /etc
parent33a0c37d13f6cb96f9b7551560bd1ce61fc183af (diff)
downloadpfsense-6ec72f51f2d0db3cad75718b976e378fd1fb0125.zip
pfsense-6ec72f51f2d0db3cad75718b976e378fd1fb0125.tar.gz
When a 0 byte configuration file is found, remove it (unlink) and continue processing.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/config.inc29
1 files changed, 17 insertions, 12 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 9732477..f4af73c 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -1619,19 +1619,24 @@ function cleanup_backupcache($revisions = 30) {
$baktimes = $backups['versions'];
$tocache = array();
unset($backups['versions']);
- foreach($bakfiles as $backup) { // Check for backups in the directory not represented in the cache.
- $tocheck = array_shift(explode('.', array_pop(explode('-', $backup))));
- if(!in_array($tocheck, $baktimes)) {
- $i = true;
- if($g['booting'])
- print " " . $tocheck . "a";
- $newxml = parse_xml_config($backup, $g['xml_rootobj']);
- if($newxml['revision']['description'] == "")
- $newxml['revision']['description'] = "Unknown";
- $tocache[$tocheck] = array('description' => $newxml['revision']['description']);
- }
- }
+ foreach($bakfiles as $backup) { // Check for backups in the directory not represented in the cache.
+ if(filesize($backup) == 0) {
+ unlink($backup);
+ continue;
+ }
+ $tocheck = array_shift(explode('.', array_pop(explode('-', $backup))));
+ if(!in_array($tocheck, $baktimes)) {
+ $i = true;
+ if($g['booting'])
+ print " " . $tocheck . "a";
+ $newxml = parse_xml_config($backup, $g['xml_rootobj']);
+ if($newxml['revision']['description'] == "")
+ $newxml['revision']['description'] = "Unknown";
+ $tocache[$tocheck] = array('description' => $newxml['revision']['description']);
+ }
+ }
foreach($backups as $checkbak) {
+
if(count(preg_grep('/' . $checkbak['time'] . '/i', $bakfiles)) != 0) {
$newbaks[] = $checkbak;
} else {
OpenPOWER on IntegriCloud