Index: branches/5.2.x/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r14628 -r14699 --- branches/5.2.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 14628) +++ branches/5.2.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 14699) @@ -1,6 +1,6 @@ Application->recallObject('SectionsHelper'); /* @var $sections_helper kSectionsHelper */ - + $section_data =& $sections_helper->getSectionData($params['section_name']); $ret = ''; @@ -567,7 +567,7 @@ $format = $lang->GetDBField($regs[1]); } - + return adodb_date($format, $timestamp); } @@ -921,56 +921,44 @@ */ function PrintBackupDates($params) { - $datearray = $this->getDirList($this->Application->ConfigValue('Backup_Path')); $ret = ''; - foreach($datearray as $key => $value) - { - $params['backuptimestamp'] = $value['filedate']; - $params['backuptime'] = date('F j, Y, g:i a', $value['filedate']); - $params['backupsize'] = round($value['filesize']/1024/1024, 2); // MBytes - $ret .= $this->Application->ParseBlock($params); - } + $datearray = $this->getBackupFiles(); + + foreach ($datearray as $value) { + $params['backuptimestamp'] = $value['filedate']; + $params['backuptime'] = date('F j, Y, g:i a', $value['filedate']); + $params['backupsize'] = round($value['filesize'] / 1024 / 1024, 2); // MBytes + $ret .= $this->Application->ParseBlock($params); + } + return $ret; } - function getDirList ($dirName) + function getBackupFiles() { - $file_helper =& $this->Application->recallObject('FileHelper'); + $file_helper =& $this->Application->recallObject('FileHelper'); /* @var $file_helper FileHelper */ - $file_helper->CheckFolder($dirName); + $ret = Array (); + $backup_path = $this->Application->ConfigValue('Backup_Path'); + $file_helper->CheckFolder($backup_path); + $backup_files = glob($backup_path . DIRECTORY_SEPARATOR . 'dump*.txt'); - $fileinfo = array(); - $d = dir($dirName); + if ( !$backup_files ) { + return Array (); + } - while($entry = $d->read()) - { - if ($entry != "." && $entry != "..") - { - if (!is_dir($dirName."/".$entry) && strpos($entry, 'dump') !== false) - { - $fileinfo[]= Array('filedate' => $this->chopchop($entry), - 'filesize' => filesize($dirName. '/'. $entry) - ); - } - } - } - $d->close(); - rsort($fileinfo); + foreach ($backup_files as $backup_file) { + $ret[] = Array ( + 'filedate' => preg_replace('/^dump([\d]+)\.txt$/', '\\1', basename($backup_file)), + 'filesize' => filesize($backup_file) + ); + } - return $fileinfo; + rsort($ret); - } + return $ret; - function chopchop ($filename) - { - $p = pathinfo($filename); - $ext = '.'.$p['extension']; - $filename; - $filename = str_replace('dump', '',$filename); - $filename = str_replace($ext, '', $filename); - - return $filename; } /**