1 update.php update_backup_form($form, &$form_state)

Form constructor for the list of available database module updates.

File

core/update.php, line 335
Administrative page for handling updates from one Backdrop version to another.

Code

function update_backup_form($form, &$form_state) {
  // Check if Backup directory is specified. If FALSE, this form shouldn't even
  // be displayed. If NULL, link to documentation on setting up backups.
  $backup_directory = backup_get_backup_directory();

  $help = '<p>' . t('Before running updates, it is recommended to create a backup of your database and configuration.') . '</p>';
  $help .= '<p>' . t('If skipping the backup process, please ensure you create a backup through a different mechanism, such as through your hosting provider.') . '</p>';

  if (empty($backup_directory) && $backup_directory !== FALSE) {
    $help .= '<p>' . t('Backups are not available because the variable !variable has not been set in !file.', array(
      '!variable' => '<code>$settings[\'backup_directory\']</code>',
      '!file' => '<code>settings.php</code>',
    )) . '</p>';
    $help .= '<p>' . t('Please check the <a href="!url">documentation on configuring backups</a>.', array(
      '!url' => 'https://docs.backdropcms.org/documentation/creating-backups',
    )) . '</p>';
  }
  else {
    $help .= '<p>' . t('The backup process may take several minutes, depending on the size of your database.') . '</p>';
  }
  $form['help'] = array(
    '#type' => 'help',
    '#markup' => $help,
    '#weight' => -5,
  );

  $form = backup_settings_form($form, $form_state);

  $query = backdrop_get_query_parameters();
  $query['op'] = 'selection';
  // Low level URL building to avoid problems with language prefix on
  // multilingual sites.
  $skip_url = $_SERVER['SCRIPT_NAME'] . '?' . backdrop_http_build_query($query);
  $form['actions']['continue'] = array(
    '#type' => 'markup',
    '#markup' => '<a href="' . $skip_url . '">' . t('Skip backup') . '</a>',
  );

  return $form;
}