diff -u b/core/includes/install.core.inc b/core/includes/install.core.inc --- b/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1094,8 +1094,13 @@ 'value' => drupal_hash_base64(drupal_random_bytes(55)), 'required' => TRUE, ); + $extras = ''; + if (!empty($form_state['storage']['database']['custom'])) { + $driver = $form_state['storage']['database']['driver']; + $extras = "drupal_classloader_register('$driver', \"db_drivers/$driver\");\n"; + } - drupal_rewrite_settings($settings); + drupal_rewrite_settings($settings, $extras); // Add the config directories to settings.php. drupal_install_config_directories(); diff -u b/core/includes/install.inc b/core/includes/install.inc --- b/core/includes/install.inc +++ b/core/includes/install.inc @@ -172,8 +172,10 @@ * * @param $settings * An array of settings that need to be updated. + * @param $extras + * Additional code to be added to settings.php. */ -function drupal_rewrite_settings($settings = array()) { +function drupal_rewrite_settings($settings = array(), $extras = '') { drupal_static_reset('conf_path'); $settings_file = conf_path(FALSE) . '/settings.php'; @@ -223,6 +225,9 @@ $buffer .= "\$$setting = " . var_export($data['value'], TRUE) . ";\n"; } } + if ($extras) { + $buffer .= "\n" . $extras; + } // Write the new settings file. if (file_put_contents(DRUPAL_ROOT . '/' . $settings_file, $buffer) === FALSE) { diff -u b/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php --- b/core/lib/Drupal/Core/Database/Database.php +++ b/core/lib/Drupal/Core/Database/Database.php @@ -375,7 +375,6 @@ } if (!empty(self::$databaseInfo[$key][$target]['custom'])) { - drupal_classloader_register($driver, "db_drivers/$driver"); $driver_class = "Drupal\\{$driver}\\Connection"; } else {