You are here

function install_change_settings in Drupal 5

Same name and namespace in other branches
  1. 6 install.php \install_change_settings()

Configure and rewrite settings.php.

1 call to install_change_settings()
install_main in ./install.php
The Drupal installation happens in a series of steps. We begin by verifying that the current environment meets our minimum requirements. We then go on to verify that settings.php is properly configured. From there we connect to the configured database…

File

./install.php, line 140

Code

function install_change_settings($profile = 'default', $install_locale = '') {
  global $db_url, $db_type, $db_prefix;
  $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
  $db_user = urldecode($url['user']);
  $db_pass = urldecode($url['pass']);
  $db_host = urldecode($url['host']);
  $db_port = isset($url['port']) ? urldecode($url['port']) : '';
  $db_path = ltrim(urldecode($url['path']), '/');
  $settings_file = './' . conf_path() . '/settings.php';

  // We always need this because we want to run form_get_errors.
  include_once './includes/form.inc';
  drupal_maintenance_theme();

  // Don't fill in placeholders
  if ($db_url == 'mysql://username:password@localhost/databasename') {
    $db_user = $db_pass = $db_path = '';
  }
  elseif (!empty($db_url)) {

    // Do not install over a configured settings.php.
    install_already_done_error();
  }

  // The existing database settings are not working, so we need write access
  // to settings.php to change them.
  if (!drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_WRITABLE)) {
    drupal_set_message(st('The @drupal installer requires write permissions to %file during the installation process.', array(
      '@drupal' => drupal_install_profile_name(),
      '%file' => $settings_file,
    )), 'error');
    drupal_set_title(st('Drupal database setup'));
    print theme('install_page', '');
    exit;
  }
  $output = drupal_get_form('install_settings_form', $profile, $install_locale, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host, $db_port, $db_path);
  drupal_set_title(st('Database configuration'));
  print theme('install_page', $output);
  exit;
}