From 6ec72f51f2d0db3cad75718b976e378fd1fb0125 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 7 Apr 2007 19:52:38 +0000 Subject: When a 0 byte configuration file is found, remove it (unlink) and continue processing. --- etc/inc/config.inc | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'etc') 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 { -- cgit v1.1