You are here

function _backup_migrate_ui_backup_settings_form in Backup and Migrate 5.2

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

Get a form to configure the profile.

2 calls to _backup_migrate_ui_backup_settings_form()
backup_migrate_ui_manual_backup_form in ./backup_migrate.module
The backup/export form.
backup_migrate_ui_profile_configure_form in includes/profiles.inc
Get a form to configure the profile.

File

includes/profiles.inc, line 245
All of the settings profiles handling code for Backup and Migrate.

Code

function _backup_migrate_ui_backup_settings_form($profile) {
  drupal_add_js(array(
    'backup_migrate' => array(
      'checkboxLinkText' => t('View as checkboxes'),
    ),
  ), 'setting');
  drupal_add_js(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.js');
  drupal_add_css(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.css');
  require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/files.inc';
  require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/db.inc';
  require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/destinations.inc';
  $form = array();
  $tables = _backup_migrate_get_table_names();
  $sources = _backup_migrate_get_destination_form_item_options('source');
  if (count($sources) > 1) {
    $form['source'] = array(
      "#type" => "fieldset",
      "#title" => t("Backup Source"),
      "#collapsible" => TRUE,
      "#collapsed" => FALSE,
      "#tree" => FALSE,
      "#description" => t("Choose the database to backup. Any database destinations you have created and any databases specified in your settings.php can be backed up."),
    );
    $form['source']['source_id'] = array(
      "#type" => "select",
      "#title" => t("Source"),
      "#options" => _backup_migrate_get_destination_form_item_options('source'),
      "#default_value" => $profile['source_id'],
    );
  }
  else {
    $form['source_id'] = array(
      "#type" => "value",
      "#value" => current(array_keys($sources)),
    );
  }
  $form['tables'] = array(
    "#type" => "fieldset",
    "#title" => t("Database Tables"),
    "#collapsible" => TRUE,
    "#collapsed" => TRUE,
    "#tree" => FALSE,
    "#description" => t("You may omit specific tables, or specific table data from the backup file. Only omit data that you know you will not need such as cache data, or tables from other applications. Excluding tables can break your Drupal install, so <strong>do not change these settings unless you know what you're doing</strong>."),
  );
  $form['tables']['exclude_tables'] = array(
    "#type" => "select",
    "#multiple" => TRUE,
    "#title" => t("Exclude the following tables altogether"),
    "#options" => $tables,
    "#default_value" => $profile['exclude_tables'],
    "#description" => t("The selected tables will not be added to the backup file."),
  );
  $form['tables']['nodata_tables'] = array(
    "#type" => "select",
    "#multiple" => TRUE,
    "#title" => t("Exclude the data from the following tables"),
    "#options" => $tables,
    "#default_value" => $profile['nodata_tables'],
    "#description" => t("The selected tables will have their structure backed up but not their contents. This is useful for excluding cache data to reduce file size."),
  );
  $form['file'] = array(
    "#type" => "fieldset",
    "#title" => t("Backup File"),
    "#collapsible" => TRUE,
    "#collapsed" => FALSE,
    "#tree" => FALSE,
  );
  $form['file']['filename'] = array(
    "#type" => "textfield",
    "#title" => t("Backup file name"),
    "#default_value" => $profile['filename'],
  );
  if (module_exists('token')) {
    $form['file']['token_help'] = array(
      '#title' => t('Replacement patterns'),
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!'),
    );
    $form['file']['token_help']['help'] = array(
      '#value' => theme('token_help', ''),
    );
    $form['file']['filename']['#description'] = t('You can use tokens to in the file name.', array(
      '!tokenurl' => 'http://drupal.org/project/token',
    ));
  }
  else {
    $form['file']['filename']['#description'] = t('If you install the <a href="!tokenurl">Token Module</a> you can use tokens to in the file name.', array(
      '!tokenurl' => 'http://drupal.org/project/token',
    ));
  }
  $form['file']['append_timestamp'] = array(
    "#type" => "checkbox",
    "#title" => t("Append a timestamp."),
    "#default_value" => $profile['append_timestamp'],
  );
  $form['file']['timestamp_format'] = array(
    "#type" => "textfield",
    "#title" => t("Timestamp format"),
    "#default_value" => $profile['timestamp_format'],
    "#description" => t('Should be a PHP <a href="!url">date()</a> format string.', array(
      '!url' => 'http://www.php.net/date',
    )),
  );
  $compression_options = _backup_migrate_get_compression_form_item_options();
  $form['file']['compression'] = array(
    "#type" => count($compression_options) > 1 ? "select" : 'value',
    "#title" => t("Compression"),
    "#options" => $compression_options,
    "#default_value" => $profile['compression'],
  );
  return $form;
}