You are here

function backup_migrate_ui_manual_restore_form in Backup and Migrate 7.2

Same name and namespace in other branches
  1. 8.2 backup_migrate.module \backup_migrate_ui_manual_restore_form()
  2. 8.3 backup_migrate.module \backup_migrate_ui_manual_restore_form()
  3. 5.2 backup_migrate.module \backup_migrate_ui_manual_restore_form()
  4. 6.3 backup_migrate.module \backup_migrate_ui_manual_restore_form()
  5. 6.2 backup_migrate.module \backup_migrate_ui_manual_restore_form()
  6. 7.3 backup_migrate.module \backup_migrate_ui_manual_restore_form()

The restore/import upload form.

1 string reference to 'backup_migrate_ui_manual_restore_form'
backup_migrate_ui_manual_restore in ./backup_migrate.module
The restore/import upload page.

File

./backup_migrate.module, line 618
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_manual_restore_form() {
  backup_migrate_include('filters', 'destinations');
  $form = array();
  $sources = _backup_migrate_get_destination_form_item_options('source');
  if (count($sources) > 1) {
    $form['source_id'] = array(
      "#type" => "select",
      "#title" => t("Restore to"),
      "#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['backup_migrate_restore_upload'] = array(
    '#title' => t('Upload a Backup File'),
    '#type' => 'file',
    '#description' => t("Upload a backup file created by this version of this module. For other database backups please use another tool for import. Max file size: %size", array(
      "%size" => format_size(file_upload_max_size()),
    )),
  );
  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'));

  // 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;
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Restore now'),
  );
  if (user_access('access backup files')) {
    $form[] = array(
      '#type' => 'markup',
      '#markup' => t('<p>Or you can restore one of the files in your <a href="!url">saved backup destinations.</a></p>', array(
        "!url" => url(BACKUP_MIGRATE_MENU_PATH . "/destination"),
      )),
    );
  }
  $form['#attributes'] = array(
    'enctype' => 'multipart/form-data',
  );
  return $form;
}