public function get()
{
if (!is_admin()) {
error('must be admin');
}
$here = $this->get_bakup_location();
$files = glob("{$here}{*.sql,*.zip}", GLOB_BRACE);
if (is_array($files)) {
usort($files, function ($a, $b) {
return filemtime($a) < filemtime($b);
});
}
$backups = array();
if (!empty($files)) {
foreach ($files as $file) {
if (strpos($file, '.sql', 1) or strpos($file, '.zip', 1)) {
$mtime = filemtime($file);
$date = date('F d Y', $mtime);
$time = date('H:i:s', $mtime);
$bak = array();
$bak['filename'] = basename($file);
$bak['date'] = $date;
$bak['time'] = str_replace('_', ':', $time);
$bak['size'] = filesize($file);
$backups[] = $bak;
}
}
}
return $backups;
}