You are here

function backup_migrate_ui_manual_backup_form in Backup and Migrate 8.2

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

The backup/export form.

1 string reference to 'backup_migrate_ui_manual_backup_form'
backup_migrate_ui_manual_backup_advanced in ./backup_migrate.module
The menu callback for advanced manual backups.

File

./backup_migrate.module, line 440
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_backup_form($form, &$form_state, $profile) {
  drupal_add_js(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.js', array(
    'type' => 'module',
    'scope' => 'footer',
  ));
  $form = array();
  $form += _backup_migrate_get_source_form('db');
  $form += _backup_migrate_ui_backup_settings_form($profile);
  $form['profile_id'] = array(
    "#type" => "value",
    '#default_value' => $profile
      ->get_id(),
  );
  $form['storage'] = array(
    "#type" => "value",
    '#default_value' => $profile->storage,
  );
  $form['destination'] = array(
    '#type' => 'details',
    "#title" => t("Backup Destination"),
    "#collapsed" => FALSE,
    "#tree" => FALSE,
    "#description" => t("Choose where the backup file will be saved. Backup files contain sensitive data, so be careful where you save them. Select 'Download' to download the file to your desktop."),
    '#weight' => 70,
  );
  $form['destination']['destination_id'] = array(
    "#type" => "select",
    "#title" => t("Destination"),
    "#options" => _backup_migrate_get_destination_form_item_options('manual backup'),
    "#default_value" => variable_get("backup_migrate_destination_id", "download"),
  );
  if (user_access('administer backup and migrate')) {
    $form['destination']['destination_id']['#description'] = l(t("Create new destination"), BACKUP_MIGRATE_MENU_PATH . "/destination/add");
  }
  if (user_access('administer backup and migrate')) {
    $form['save_settings'] = array(
      "#type" => "checkbox",
      "#title" => t('Save these settings.'),
      "#default_value" => FALSE,
      '#weight' => 80,
    );
    $form['save_options'] = array(
      '#prefix' => '<div class="backup-migrate-save-options">',
      '#suffix' => '</div>',
      '#weight' => 90,
    );
    $name = array(
      '#default_value' => $profile
        ->get('name'),
      '#type' => 'textfield',
      '#title' => t('Save the settings as'),
    );
    if ($profile
      ->get_id()) {
      $form['save_options']['create_new'] = array(
        '#default_value' => $profile
          ->get('name'),
        '#type' => 'radios',
        '#default_value' => 0,
        '#options' => array(
          0 => t("Replace the '%profile' profile", array(
            '%profile' => $profile
              ->get('name'),
          )),
          1 => t('Create new profile'),
        ),
      );
      $name["#title"] = t('Profile name');
      $name["#description"] = t("This will be the name of your new profile if you select 'Create new profile' otherwise it will become the name of the '%profile' profile.", array(
        '%profile' => $profile
          ->get('name'),
      ));
    }
    else {
      $name["#title"] = t('Save the settings as');
      $name["#description"] = t('Pick a name for the settings. Your settings will be saved as a profile and will appear in the <a href="!url">Profiles Tab</a>.', array(
        '!url' => url(BACKUP_MIGRATE_MENU_PATH . '/profile'),
      ));
      $name["#default_value"] = t('Untitled Profile');
    }
    $form['save_options']['name'] = $name;
    $form['save_options'][] = array(
      '#type' => 'submit',
      '#value' => t('Save Without Backing Up'),
    );
  }
  $form['#validate'][] = 'backup_migrate_ui_manual_quick_backup_form_validate';
  $form['#submit'][] = 'backup_migrate_ui_manual_backup_form_submit';
  $form[] = array(
    '#type' => 'submit',
    '#value' => t('Backup now'),
    '#weight' => 100,
  );
  return $form;
}