From 33b09cc5eb6f602e8007ce4cf799b30aacc4021e Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Mon, 12 Oct 2009 02:00:04 +0000 Subject: #589754 by rfay and Crell: Fixed non-recoverable install if invalid database specified in settings.php. --- includes/database/database.inc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'includes/database') diff --git a/includes/database/database.inc b/includes/database/database.inc index e04f32a16..82ac78bc7 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -1246,7 +1246,7 @@ abstract class Database { /** * Process the configuration file for database information. */ - final protected static function parseConnectionInfo() { + final public static function parseConnectionInfo() { global $databases; _db_check_install_needed(); @@ -1263,7 +1263,20 @@ abstract class Database { } } - self::$databaseInfo = $databaseInfo; + if (!is_array(self::$databaseInfo)) { + self::$databaseInfo = $databaseInfo; + } + + // Merge the new $databaseInfo into the existing. + // array_merge_recursive() cannot be used, as it would make multiple + // database, user, and password keys in the same database array. + else { + foreach ($databaseInfo as $database_key => $database_values) { + foreach ($database_values as $target => $target_values) { + self::$databaseInfo[$database_key][$target] = $target_values; + } + } + } } /** @@ -2414,4 +2427,4 @@ function _db_check_install_needed() { include_once DRUPAL_ROOT . '/includes/install.inc'; install_goto('install.php'); } -} \ No newline at end of file +} -- cgit v1.2.3