You are here

function backup_migrate_ui_destination_restore_file_confirm in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.2 includes/destinations.inc \backup_migrate_ui_destination_restore_file_confirm()
  2. 8.3 includes/destinations.inc \backup_migrate_ui_destination_restore_file_confirm()
  3. 5.2 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 410

Code

function backup_migrate_ui_destination_restore_file_confirm(&$form_state, $destination_id, $file_id) {
  $sources = _backup_migrate_get_source_form_item_options();
  if (count($sources) > 1) {
    $form['source_id'] = array(
      "#type" => "select",
      "#title" => t("Restore to"),
      "#options" => $sources,
      "#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'] = 'fieldset';
    $form['advanced']['#title'] = t('Advanced Options');
    $form['advanced']['#collapsed'] = true;
    $form['advanced']['#collapsible'] = true;
  }
  return $form;
}