function backup_migrate_destination_get_latest_file in Backup and Migrate 7.3
Same name and namespace in other branches
- 8.3 includes/destinations.inc \backup_migrate_destination_get_latest_file()
Load a file from a destination and return the file info.
File
- includes/
destinations.inc, line 180
Code
function backup_migrate_destination_get_latest_file($destination_id) {
$out = NULL;
if ($destination = backup_migrate_get_destination($destination_id)) {
$files = $destination
->list_files();
$max = 0;
foreach ((array) $files as $file) {
$info = $file
->info();
// If there's a datestamp, it should override the filetime as it's probably more reliable.
$time = !empty($info['datestamp']) ? $info['datestamp'] : $info['filetime'];
if ($time > $max) {
$max = $time;
$out = $file;
}
}
}
return $out;
}