You are here

function backup_migrate_destination_db_conf in Backup and Migrate 5.2

Destination configuration callback.

1 string reference to 'backup_migrate_destination_db_conf'
backup_migrate_backup_migrate_destination_types in includes/destinations.inc
Implementation of hook_backup_migrate_destination_types().

File

includes/destinations.db.inc, line 31
Functions to handle the direct to database destination.

Code

function backup_migrate_destination_db_conf($destination, $form) {
  $form['scheme'] = array(
    "#type" => "select",
    "#title" => t("Database Type"),
    "#default_value" => $destination['scheme'] ? $destination['scheme'] : 'mysql',
    "#required" => TRUE,
    '#options' => array(
      $GLOBALS['db_type'] => $GLOBALS['db_type'],
    ),
    "#description" => t('The type of the database. Drupal only supports one database type at a time, so this must be the same as the current database type.'),
  );
  $form['host'] = array(
    "#type" => "textfield",
    "#title" => t("Database Host"),
    "#default_value" => $destination['host'] ? $destination['host'] : 'localhost',
    "#required" => TRUE,
    "#description" => t('The host of the database.'),
  );
  $form['path'] = array(
    "#type" => "textfield",
    "#title" => t("Database Name"),
    "#default_value" => $destination['path'],
    "#required" => TRUE,
    "#description" => t('The name of the database. The database must exist, it will not be created for you.'),
  );
  $form['user'] = array(
    "#type" => "textfield",
    "#title" => t("Database User"),
    "#default_value" => $destination['user'],
    "#required" => TRUE,
    "#description" => t('Enter the name of a user who has write access to the database.'),
  );
  $form['password'] = array(
    "#type" => "password",
    "#title" => t("Database Password"),
    "#default_value" => $destination['password'],
    "#description" => t('Enter the password for the user.'),
  );
  if ($destination['password']) {
    $form['old_password'] = array(
      "#type" => "value",
      "#value" => $destination['password'],
    );
    $form['password']["#description"] .= t(' You do not need to enter a password unless you wish to change the currently saved password.');
  }
  $form['#validate'] = array(
    'backup_migrate_destination_db_conf_validate' => array(),
  );
  $form['#submit'] = array(
    'backup_migrate_destination_db_conf_submit' => array(),
    'backup_migrate_ui_destination_configure_form_submit' => array(),
  );
  return $form;
}