function backup_migrate_drush_destination_files in Backup and Migrate 6.2
Same name and namespace in other branches
- 8.2 includes/backup_migrate.drush.inc \backup_migrate_drush_destination_files()
- 8.3 includes/backup_migrate.drush.inc \backup_migrate_drush_destination_files()
- 6.3 includes/backup_migrate.drush.inc \backup_migrate_drush_destination_files()
- 7.3 includes/backup_migrate.drush.inc \backup_migrate_drush_destination_files()
- 7.2 includes/backup_migrate.drush.inc \backup_migrate_drush_destination_files()
Get a list of files in a given destination
1 string reference to 'backup_migrate_drush_destination_files'
- backup_migrate_drush_command in includes/
backup_migrate.drush.inc - Implementation of hook_drush_command().
File
- includes/
backup_migrate.drush.inc, line 191 - Drush commands for backup and migrate.
Code
function backup_migrate_drush_destination_files($destination_id = NULL) {
backup_migrate_include('destinations');
// Set the message mode to drush output.
_backup_migrate_message_callback('_backup_migrate_message_drush');
if (!$destination_id) {
_backup_migrate_message("You must specify an existing destination. Try using 'drush bam-destinations' to get a list of available destinations.", array(
'@destination' => $destination_id,
), 'error');
return;
}
if (!($destination = backup_migrate_get_destination($destination_id))) {
_backup_migrate_message("Could not find the destination '@destination'. Try using 'drush bam-destinations' to get a list of available destinations.", array(
'@destination' => $destination_id,
), 'error');
return;
}
$out = array(
array(
dt('Filename'),
dt('Date'),
dt('Age'),
dt('Size'),
),
);
$files = $destination
->list_files();
$i = 0;
foreach ((array) $files as $file) {
// Show only files that can be restored from.
if ($file
->is_recognized_type()) {
$info = $file
->info();
$out[] = array(
check_plain($info['filename']),
format_date($info['filetime'], 'small'),
format_interval(time() - $info['filetime'], 1),
format_size($info['filesize']),
);
}
}
if (count($out) > 1) {
drush_print_table($out, TRUE);
}
else {
drush_print(dt('There are no backup files to display.'));
}
}