? includes/.bootstrap.inc.swp
Index: includes/install.core.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.core.inc,v
retrieving revision 1.41
diff -r1.41 install.core.inc
853c853
< $drivers = drupal_detect_database_types();
---
> $drivers = drupal_get_database_types();
860d859
< '#options' => $drivers,
869,934c868,882
< // Database name.
< $form['database'] = array(
< '#type' => 'textfield',
< '#title' => st('Database name'),
< '#default_value' => empty($database['database']) ? '' : $database['database'],
< '#size' => 45,
< '#required' => TRUE,
< '#description' => st('The name of the database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('@drupal' => drupal_install_profile_distribution_name())),
< );
<
< // Database username.
< $form['username'] = array(
< '#type' => 'textfield',
< '#title' => st('Database username'),
< '#default_value' => empty($database['username']) ? '' : $database['username'],
< '#size' => 45,
< );
<
< // Database password.
< $form['password'] = array(
< '#type' => 'password',
< '#title' => st('Database password'),
< '#default_value' => empty($database['password']) ? '' : $database['password'],
< '#size' => 45,
< );
<
< $form['advanced_options'] = array(
< '#type' => 'fieldset',
< '#title' => st('Advanced options'),
< '#collapsible' => TRUE,
< '#collapsed' => TRUE,
< '#description' => st("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider.")
< );
<
< // Database host.
< $form['advanced_options']['host'] = array(
< '#type' => 'textfield',
< '#title' => st('Database host'),
< '#default_value' => empty($database['host']) ? 'localhost' : $database['host'],
< '#size' => 45,
< // Hostnames can be 255 characters long.
< '#maxlength' => 255,
< '#required' => TRUE,
< '#description' => st('If your database is located on a different server, change this.'),
< );
<
< // Database port.
< $form['advanced_options']['port'] = array(
< '#type' => 'textfield',
< '#title' => st('Database port'),
< '#default_value' => empty($database['port']) ? '' : $database['port'],
< '#size' => 45,
< // The maximum port number is 65536, 5 digits.
< '#maxlength' => 5,
< '#description' => st('If your database server is listening to a non-standard port, enter its number.'),
< );
<
< // Table prefix.
< $db_prefix = ($profile == 'standard') ? 'drupal_' : $profile . '_';
< $form['advanced_options']['db_prefix'] = array(
< '#type' => 'textfield',
< '#title' => st('Table prefix'),
< '#default_value' => '',
< '#size' => 45,
< '#description' => st('If more than one application will be sharing this database, enter a table prefix such as %prefix for your @drupal site here.', array('@drupal' => drupal_install_profile_distribution_name(), '%prefix' => $db_prefix)),
< );
---
> // Add driver specific configuration options.
> foreach ($drivers as $key => $driver) {
> $form['driver']['#options'][$key] = $driver->name();
>
> $form['settings'][$key] = $driver->getFormOptions($database);
> $form['settings'][$key]['#prefix'] = '
' . st('@driver_name settings', array('@driver_name' => $driver->name())) . '
';
> $form['settings'][$key]['#type'] = 'container';
> $form['settings'][$key]['#tree'] = TRUE;
> $form['settings'][$key]['advanced_options']['#parents'] = array($key);
> $form['settings'][$key]['#states'] = array(
> 'visible' => array(
> ':input[name=driver]' => array('value' => $key),
> )
> );
> }
939a888,892
> '#limit_validation_errors' => array(
> array('driver'),
> array(isset($form_state['input']['driver']) ? $form_state['input']['driver'] : current($drivers_keys)),
> ),
> '#submit' => array('install_settings_form_submit'),
944d896
< $form['_database'] = array('#type' => 'value');
952a905,909
> $driver = $form_state['values']['driver'];
> $database = $form_state['values'][$driver];
> $database['driver'] = $driver;
> $form_state['storage']['database'] = $database;
>
955c912
< $form_state['values']['prefix'] = $form_state['values']['db_prefix'];
---
> $database['prefix'] = $database['db_prefix'];
957,958c914
< form_set_value($form['_database'], $form_state['values'], $form_state);
< $errors = install_database_errors($form_state['values'], $form_state['values']['settings_file']);
---
> $errors = install_database_errors($database, $form_state['values']['settings_file']);
970,977d925
< // Verify the table prefix.
< if (!empty($database['prefix']) && is_string($database['prefix']) && !preg_match('/^[A-Za-z0-9_.]+$/', $database['prefix'])) {
< $errors['prefix'] = st('The database table prefix you have entered, %prefix, is invalid. The table prefix can only contain alphanumeric characters, periods, or underscores.', array('%prefix' => $database['prefix']));
< }
<
< if (!empty($database['port']) && !is_numeric($database['port'])) {
< $errors['db_port'] = st('Database port must be a number.');
< }
980c928
< $database_types = drupal_detect_database_types();
---
> $database_types = drupal_get_database_types();
985a934,936
> // Run driver specific validation
> $errors += $database_types[$driver]->validateDatabaseSettings($database);
>
1012c963
< $database = array_intersect_key($form_state['values']['_database'], array_flip(array('driver', 'database', 'username', 'password', 'host', 'port', 'prefix')));
---
> $database = $form_state['storage']['database'];
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.146
diff -r1.146 install.inc
192a193,194
> global $install_state;
>
195,196c197
< if (drupal_installation_attempted()) {
< global $install_state;
---
> if (drupal_installation_attempted() && isset($install_state['profile_info']['distribution_name'])) {
232a234,249
> $databases = drupal_get_database_types();
>
> foreach ($databases as $driver => $installer) {
> $databases[$driver] = $installer->name();
> }
>
> return $databases;
> }
>
> /**
> * Return all supported database installer objects that are compiled into PHP.
> *
> * @return
> * An array of database installer objects compiled into PHP.
> */
> function drupal_get_database_types() {
252c269
< $databases[$driver] = $installer->name();
---
> $databases[$driver] = $installer;
447a465,569
>
> /**
> * Return driver specific configuration options.
> *
> * @param $database
> * @return
> * The options form array.
> */
> public function getFormOptions($database) {
> $form['database'] = array(
> '#type' => 'textfield',
> '#title' => st('Database name'),
> '#default_value' => empty($database['database']) ? '' : $database['database'],
> '#size' => 45,
> '#required' => TRUE,
> '#description' => st('The name of the database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('@drupal' => drupal_install_profile_distribution_name())),
> );
>
> $form['username'] = array(
> '#type' => 'textfield',
> '#title' => st('Database username'),
> '#default_value' => empty($database['username']) ? '' : $database['username'],
> '#required' => TRUE,
> '#size' => 45,
> );
>
> $form['password'] = array(
> '#type' => 'password',
> '#title' => st('Database password'),
> '#default_value' => empty($database['password']) ? '' : $database['password'],
> '#required' => TRUE,
> '#size' => 45,
> );
>
> $form['advanced_options'] = array(
> '#type' => 'fieldset',
> '#title' => st('Advanced options'),
> '#collapsible' => TRUE,
> '#collapsed' => TRUE,
> '#description' => st("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider."),
> '#weight' => 10,
> );
>
> $profile = drupal_get_profile();
> $db_prefix = ($profile == 'standard') ? 'drupal_' : $profile . '_';
> $form['advanced_options']['db_prefix'] = array(
> '#type' => 'textfield',
> '#title' => st('Table prefix'),
> '#default_value' => '',
> '#size' => 45,
> '#description' => st('If more than one application will be sharing this database, enter a table prefix such as %prefix for your @drupal site here.', array('@drupal' => drupal_install_profile_distribution_name(), '%prefix' => $db_prefix)),
> '#weight' => 10,
> );
>
> $form['advanced_options']['host'] = array(
> '#type' => 'textfield',
> '#title' => st('Database host'),
> '#default_value' => empty($database['host']) ? 'localhost' : $database['host'],
> '#size' => 45,
> // Hostnames can be 255 characters long.
> '#maxlength' => 255,
> '#required' => TRUE,
> '#description' => st('If your database is located on a different server, change this.'),
> );
>
> $form['advanced_options']['port'] = array(
> '#type' => 'textfield',
> '#title' => st('Database port'),
> '#default_value' => empty($database['port']) ? '' : $database['port'],
> '#size' => 45,
> // The maximum port number is 65536, 5 digits.
> '#maxlength' => 5,
> '#description' => st('If your database server is listening to a non-standard port, enter its number.'),
> );
>
> return $form;
> }
>
> /**
> * Validates driver specific configuration settings.
> *
> * Checks to ensure correct basic database settings and that a proper
> * connection to the database can be established.
> *
> * @param $database
> * An array of driver specific configuration options.
> * @return
> * An array of driver configuration errors, keyed by form element name.
> */
> public function validateDatabaseSettings($database) {
> $errors = array();
>
> // Verify the table prefix.
> if (!empty($database['prefix']) && is_string($database['prefix']) && !preg_match('/^[A-Za-z0-9_.]+$/', $database['prefix'])) {
> $errors[$database['driver'] . '][advanced_options][db_prefix'] = st('The database table prefix you have entered, %prefix, is invalid. The table prefix can only contain alphanumeric characters, periods, or underscores.', array('%prefix' => $database['prefix']));
> }
>
> // Verify the database port.
> if (!empty($database['port']) && !is_numeric($database['port'])) {
> $errors[$database['driver'] . '][advanced_options][port'] = st('Database port must be a number.');
> }
>
> return $errors;
> }
>
448a571
>
Index: includes/database/sqlite/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/sqlite/install.inc,v
retrieving revision 1.4
diff -r1.4 install.inc
23a24,38
>
> public function getFormOptions($database) {
> $form = parent::getFormOptions($database);
>
> // Remove the options that only apply to client/server style databases.
> unset($form['username'], $form['password'], $form['advanced_options']['host'], $form['advanced_options']['port']);
>
> // Make the text more accurate for SQLite.
> $form['database']['#title'] = st('Database file');
> $form['database']['#description'] = st('The path and name of the file that your @drupal data will be stored in. @drupal must always have write permissions for both the file and the directory where the database file resides. It is strongly suggested that you choose a path that is outside of the webroot, yet ensure that the directory is writeable by the web server.', array('@drupal' => drupal_install_profile_distribution_name()));
> $default_database = conf_path(FALSE, TRUE) . '/files/.ht.sqlite';
> $form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
> return $form;
> }
>