You are here

function backup_migrate_ui_destination_restore_file_confirm in Backup and Migrate 8.2

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

Ask confirmation for file restore.

1 string reference to 'backup_migrate_ui_destination_restore_file_confirm'
backup_migrate_ui_destination_restore_file in includes/destinations.inc
Restore a backup file from a destination.

File

includes/destinations.inc, line 356

Code

function backup_migrate_ui_destination_restore_file_confirm($form, &$form_state, $destination_id, $file_id) {
  $sources = _backup_migrate_get_destination_form_item_options('source');
  if (count($sources) > 1) {
    $form['source_id'] = array(
      "#type" => "select",
      "#title" => t("Database"),
      "#options" => _backup_migrate_get_destination_form_item_options('source'),
      "#description" => t("Choose the database to restore to. Any database destinations you have created and any databases specified in your settings.php can be restored to."),
      "#default_value" => 'db',
    );
  }
  else {
    $form['source_id'] = array(
      "#type" => "value",
      "#value" => 'db',
    );
  }
  $form['destination_id'] = array(
    '#type' => 'value',
    '#value' => $destination_id,
  );
  $form['file_id'] = array(
    '#type' => 'value',
    '#value' => $file_id,
  );
  $form = confirm_form($form, t('Are you sure you want to restore the database?'), BACKUP_MIGRATE_MENU_PATH . "/destination/list/files/" . $destination_id, t('Are you sure you want to restore the database from the backup file %file_id? This will delete some or all of your data and cannot be undone. <strong>Always test your backups on a non-production server!</strong>', array(
    '%file_id' => $file_id,
  )), t('Restore'), t('Cancel'));
  drupal_set_message(t('Restoring will delete some or all of your data and cannot be undone. <strong>Always test your backups on a non-production server!</strong>'), 'warning', FALSE);
  $form = array_merge_recursive($form, backup_migrate_filters_settings_form(backup_migrate_filters_settings_default('restore'), 'restore'));
  $form['actions']['#weight'] = 100;

  // Add the advanced fieldset if there are any fields in it.
  if (@$form['advanced']) {
    $form['advanced']['#type'] = 'details';
    $form['advanced']['#title'] = t('Advanced Options');
    $form['advanced']['#collapsed'] = true;
  }
  return $form;
}