You are here

function backup_migrate_ui_destination_display_files in Backup and Migrate 5.2

Same name and namespace in other branches
  1. 8.2 includes/destinations.inc \backup_migrate_ui_destination_display_files()
  2. 8.3 includes/destinations.inc \backup_migrate_ui_destination_display_files()
  3. 6.3 includes/destinations.inc \backup_migrate_ui_destination_display_files()
  4. 6.2 includes/destinations.inc \backup_migrate_ui_destination_display_files()
  5. 7.3 includes/destinations.inc \backup_migrate_ui_destination_display_files()
  6. 7.2 includes/destinations.inc \backup_migrate_ui_destination_display_files()

List the backup files in the given destination.

1 string reference to 'backup_migrate_ui_destination_display_files'
backup_migrate_menu in ./backup_migrate.module
Implementation of hook_menu().

File

includes/destinations.inc, line 354
All of the destination handling code needed for Backup and Migrate.

Code

function backup_migrate_ui_destination_display_files($destination_id) {
  $out = $sort = array();
  if ($destination = backup_migrate_get_destination($destination_id)) {
    $headers = array(
      array(
        'data' => 'Filename',
        'field' => 'filename',
      ),
      array(
        'data' => 'Last Modified',
        'field' => 'filemtime',
      ),
      array(
        'data' => 'Size',
        'field' => 'filesize',
      ),
      t('Operations'),
    );
    $sort_order = tablesort_get_order($headers);
    $sort_key = $sort_order['sql'] ? $sort_order['sql'] : 'filename';
    $sort_dir = tablesort_get_sort($headers) == 'asc' ? SORT_ASC : SORT_DESC;
    $files = backup_migrate_destination_get_files($destination);

    // Don't display the download/delete/restore ops if they are not available for this destination.
    $can_read = !empty($destination['load_callback']);
    $can_delete = !empty($destination['delete_callback']);
    $i = 0;
    foreach ((array) $files as $info) {
      $sort[] = $info[$sort_key];
      $out[] = array(
        check_plain($info['filename']),
        format_date($info['filemtime'], 'small'),
        format_size($info['filesize']),
        implode(" | ", _backup_migrate_destination_get_file_links($destination_id, $info['file_id'])),
      );
    }
    array_multisort($sort, $sort_dir, $out);
    if ($out) {
      return theme("table", $headers, $out);
    }
    else {
      return t('There are no backup files to display.');
    }
  }
  drupal_goto("admin/content/backup_migrate/destination");
}