diff -u b/core/includes/bootstrap.inc b/core/includes/bootstrap.inc --- b/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -727,7 +727,7 @@ global $base_url, $base_path, $base_root, $script_path; // Export these settings.php variables to the global namespace. - global $cookie_domain, $conf, $installed_profile, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url, $config_directories; + global $databases, $cookie_domain, $conf, $installed_profile, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url, $config_directories; $conf = array(); // Make conf_path() available as local variable in settings.php. @@ -2303,7 +2303,8 @@ // installed yet (i.e., if no $databases array has been defined in the // settings.php file) and we are not already installing. $databases = settings()->get('databases'); - if (empty($databases) && !drupal_installation_attempted()) { + $databases_d7 = $GLOBALS['databases']; + if (empty($databases) && empty($databases_d7) && !drupal_installation_attempted()) { include_once DRUPAL_ROOT . '/core/includes/install.inc'; install_goto('core/install.php'); } 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 @@ -416,8 +416,7 @@ $task = NULL; // Do not install over a configured settings.php. - $databases = settings()->get('databases'); - if (!empty($databases)) { + if (!empty($GLOBALS['databases'])) { throw new Exception(install_already_done_error()); } } @@ -429,7 +428,8 @@ $task = NULL; // Do not install over a configured settings.php. - if (!empty($GLOBALS['databases'])) { + $databases = settings()->get('databases'); + if (!empty($databases)) { throw new Exception(install_already_done_error()); } } @@ -949,7 +949,7 @@ * Verifies that settings.php specifies a valid database connection. */ function install_verify_database_settings() { - $databases = settings()->get('databases'); + global $databases; if (!empty($databases)) { $database = $databases['default']['default']; drupal_static_reset('conf_path'); @@ -961,7 +961,7 @@ * Verifies that settings.php specifies a valid database connection. */ function install_verify_database_settings() { - global $databases; + $databases = settings()->get('databases'); if (!empty($databases)) { $database = $databases['default']['default']; drupal_static_reset('conf_path'); @@ -973,7 +973,7 @@ * @ingroup forms */ function install_settings_form($form, &$form_state, &$install_state) { - $databases = settings()->get('databases'); + global $databases; $profile = $install_state['parameters']['profile']; drupal_static_reset('conf_path'); @@ -985,7 +985,7 @@ * @ingroup forms */ function install_settings_form($form, &$form_state, &$install_state) { - global $databases; + $databases = settings()->get('databases'); $profile = $install_state['parameters']['profile']; drupal_static_reset('conf_path'); @@ -1062,6 +1062,7 @@ * Checks a database connection and returns any errors. */ function install_database_errors($database, $settings_file) { + global $databases; $errors = array(); // Check database type. @@ -1073,7 +1074,6 @@ * Checks a database connection and returns any errors. */ function install_database_errors($database, $settings_file) { - global $databases; $errors = array(); // Check database type. only in patch2: unchanged: --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -373,6 +373,9 @@ function _drupal_rewrite_settings_global(&$ref, $variable) { if (is_object($variable)) { $ref = $variable->value; } + elseif (is_scalar($variable)) { + $ref = $variable; + } else { foreach ($variable as $k => $v) { _drupal_rewrite_settings_global($ref[$k], $v); @@ -400,6 +403,9 @@ function _drupal_rewrite_settings_dump($variable, $variable_name) { $return .= _drupal_rewrite_settings_dump_one($variable, "$variable_name = ", "\n"); } } + elseif (is_scalar($variable)) { + $return .= _drupal_rewrite_settings_dump_one($variable, "$variable_name = $variable;\n"); + } else { foreach ($variable as $k => $v) { $return .= _drupal_rewrite_settings_dump($v, $variable_name . "['" . $k . "']"); only in patch2: unchanged: --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -92,9 +92,14 @@ function update_check_incompatibility($name, $type = 'module') { function update_prepare_d8_bootstrap() { include_once DRUPAL_ROOT . '/core/includes/install.inc'; include_once DRUPAL_ROOT . '/core/includes/schema.inc'; + // Bootstrap to configuration. drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); + // Update the db settings. + $settings['settings']['databases'] = isset($GLOBALS['databases']) ? $GLOBALS['databases'] : array(); + drupal_rewrite_settings($settings); + // During the bootstrap to DRUPAL_BOOTSTRAP_PAGE_CACHE, code will try to read // the cache but the cache tables are not compatible yet. Use the Null backend // by default to avoid exceptions.