=== modified file 'includes/bootstrap.inc' --- includes/bootstrap.inc 2008-11-07 17:21:53 +0000 +++ includes/bootstrap.inc 2008-11-10 03:41:38 +0000 @@ -1043,7 +1043,7 @@ function drupal_anonymous_user($session * DRUPAL_BOOTSTRAP_FULL: Drupal is fully loaded, validate and fix input data. */ function drupal_bootstrap($phase = NULL) { - static $phases = array(DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_VARIABLES, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL), $completed_phase = -1; + static $phases = array(DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_VARIABLES, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL), $completed_phase = -1; if (isset($phase)) { while ($phases && $phase > $completed_phase) { @@ -1071,6 +1071,15 @@ function _drupal_bootstrap($phase) { switch ($phase) { + case DRUPAL_BOOTSTRAP_DATABASE: + // Initialize the database system. Note that the connection + // won't be initialized until it is actually requested. + require_once DRUPAL_ROOT . '/includes/database/database.inc'; + // Register autoload functions so that we can access classes and interfaces. + spl_autoload_register('drupal_autoload_class'); + spl_autoload_register('drupal_autoload_interface'); + break; + case DRUPAL_BOOTSTRAP_CONFIGURATION: drupal_initialize_variables(); // Start a page timer: @@ -1092,15 +1101,6 @@ function _drupal_bootstrap($phase) { } break; - case DRUPAL_BOOTSTRAP_DATABASE: - // Initialize the database system. Note that the connection - // won't be initialized until it is actually requested. - require_once DRUPAL_ROOT . '/includes/database/database.inc'; - // Register autoload functions so that we can access classes and interfaces. - spl_autoload_register('drupal_autoload_class'); - spl_autoload_register('drupal_autoload_interface'); - break; - case DRUPAL_BOOTSTRAP_ACCESS: // Deny access to blocked IP addresses - t() is not yet available. if (drupal_is_denied(ip_address())) { @@ -1461,7 +1461,7 @@ function _registry_check_code($type, $na // This function may get called when the default database is not active, but // there is no reason we'd ever want to not use the default database for // this query. - $file = Database::getConnection('default')->query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array( + $file = Database::getConnection('_bootstrap')->query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array( ':name' => $name, ':type' => $type, )) === modified file 'includes/database/database.inc' --- includes/database/database.inc 2008-11-09 15:32:22 +0000 +++ includes/database/database.inc 2008-11-10 03:40:34 +0000 @@ -915,7 +915,7 @@ abstract class Database { if (!isset(self::$connections[$key][$target])) { // If we're trying to open a target that doesn't exist, we need to know // what the actual target we got was. - $target = self::openConnection(self::$activeKey, $target); + $target = self::openConnection(empty(self::$connections) ? '_bootstrap' : self::$activeKey, $target); } return isset(self::$connections[$key][$target]) ? self::$connections[$key][$target] : NULL; @@ -971,6 +971,15 @@ abstract class Database { } } } + $databaseInfo['_bootstrap']['default'] = array( + 'driver' => 'sqlite', + 'database' => conf_path() . '/files/.ht.sqlite', + 'username' => '', + 'password' => '', + 'host' => 'localhost', + 'port' => '', + ); + self::$databaseInfo = $databaseInfo; }