You are here

function backup_migrate_ui_saved_backups in Backup and Migrate 8.3

Same name and namespace in other branches
  1. 6.3 backup_migrate.module \backup_migrate_ui_saved_backups()
  2. 7.3 backup_migrate.module \backup_migrate_ui_saved_backups()

List the previously created backups from accross multiple destinations.

1 string reference to 'backup_migrate_ui_saved_backups'
backup_migrate_menu in ./backup_migrate.module
Implements hook_menu().

File

./backup_migrate.module, line 1351
Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (e.g. cache_*)

Code

function backup_migrate_ui_saved_backups() {
  backup_migrate_include('profiles', 'destinations', 'sources');
  drupal_add_css(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.css');
  $remote = FALSE;
  $now = $fetch_time = time();
  $refresh = isset($_GET['refresh']);
  $out = '';
  list($files, $fetch_time, $remote) = backup_migrate_get_saved_backups($refresh);

  // Redirect if refreshing instead of displaying.
  if ($refresh) {
    drupal_goto($_GET['q']);
  }
  $fetch = $out = '';

  // Get the fetch link.
  if ($fetch_time < $now) {
    $fetch = '<div class="description">' . t('This listing was fetched !time ago. !refresh', array(
      '!time' => format_interval($now - $fetch_time, 1),
      '!refresh' => l(t('fetch now'), $_GET['q'], array(
        'query' => array(
          'refresh' => 'true',
        ),
      )),
    )) . '</div>';
  }

  // Render the list.
  $out .= $fetch;
  $out .= _backup_migrate_ui_destination_display_file_list($files, array(
    'limit' => 20,
    'pager' => TRUE,
  ));
  $out .= $fetch;

  // Add a remote backups warning if there are no remote backups.
  if (!$remote && user_access('administer backup and migrate')) {
    drupal_set_message(t('You do not have any offsite backups. For the highest level of protection, <a href="!addurl">create an offsite destination</a> or <a href="!nsurl">set up NodeSquirrel</a> to save your backups to.', array(
      '!addurl' => url(BACKUP_MIGRATE_MENU_PATH . '/settings/destination/add'),
      '!nsurl' => url(BACKUP_MIGRATE_MENU_PATH . '/nodesquirrel'),
    )), 'warning', FALSE);
  }
  return $out;
}