=== modified file 'includes/bootstrap.inc' --- includes/bootstrap.inc 2008-11-11 22:39:58 +0000 +++ includes/bootstrap.inc 2008-11-15 16:56:17 +0000 @@ -413,8 +413,7 @@ function conf_init() { global $base_url, $base_path, $base_root; // Export the following settings.php variables to the global namespace - global $databases, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access; - $conf = array(); + global $db_prefix, $cookie_domain, $installed_profile, $update_free_access; if (!drupal_valid_http_host()) { // HTTP_HOST is invalid, e.g. if containing slashes it may be an attack. @@ -566,21 +565,8 @@ function drupal_get_filename($type, $nam * with variable_set() as well as those explicitly specified in the configuration * file. */ -function variable_init($conf = array()) { - // NOTE: caching the variables improves performance by 20% when serving cached pages. - if ($cached = cache_get('variables', 'cache')) { - $variables = $cached->data; - } - else { - $variables = array_map('unserialize', db_query('SELECT name, value FROM {variable}')->fetchAllKeyed()); - cache_set('variables', $variables); - } - - foreach ($conf as $name => $value) { - $variables[$name] = $value; - } - - return $variables; +function variable_init() { + return array_map('unserialize', Database::getConnection('_bootstrap')->query('SELECT name, value FROM {variable}')->fetchAllKeyed()); } /** @@ -1053,7 +1039,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_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, 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) { @@ -1077,16 +1063,32 @@ function drupal_get_bootstrap_phase() { } function _drupal_bootstrap($phase) { - global $conf; + global $conf, $databases; switch ($phase) { - case DRUPAL_BOOTSTRAP_CONFIGURATION: + 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'); + // Initialize configuration variables. + $conf = variable_init(); drupal_initialize_variables(); - // Start a page timer: - timer_start('page'); // Initialize the configuration conf_init(); + $databases = variable_get('databases', NULL); + // If there are no databases then we need to install, but first we + // rebuild the registry and then the next page will build the menu. + if (!$databases && !(isset($_GET['q']) && $_GET['q'] == 'install')) { + registry_rebuild(); + require_once DRUPAL_ROOT . '/includes/install.inc'; + install_goto('index.php?q=install'); + } + // Start a page timer: + timer_start('page'); break; case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE: @@ -1102,15 +1104,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())) { @@ -1126,11 +1119,6 @@ function _drupal_bootstrap($phase) { session_start(); break; - case DRUPAL_BOOTSTRAP_VARIABLES: - // Initialize configuration variables, using values from settings.php if available. - $conf = variable_init(isset($conf) ? $conf : array()); - break; - case DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE: // Load module handling. require_once DRUPAL_ROOT . '/includes/module.inc'; @@ -1514,7 +1502,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-15 08:23:06 +0000 +++ includes/database/database.inc 2008-11-15 16:59:56 +0000 @@ -916,9 +916,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($key, $target); } return isset(self::$connections[$key][$target]) ? self::$connections[$key][$target] : NULL; @@ -961,9 +959,7 @@ abstract class Database { final protected static function parseConnectionInfo() { global $databases; - _db_check_install_needed(); - - $databaseInfo = $databases; + $databaseInfo = $databases ? $databases : array(); foreach ($databaseInfo as $index => $info) { foreach ($databaseInfo[$index] as $target => $value) { // If there is no "driver" property, then we assume it's an array of @@ -974,6 +970,11 @@ abstract class Database { } } } + $databaseInfo['_bootstrap']['default'] = array( + 'driver' => 'sqlite', + 'database' => 'sites/default/files/.ht.boot.sqlite', + ); + $databaseInfo['default'] = $databaseInfo['_bootstrap']; self::$databaseInfo = $databaseInfo; } @@ -1036,7 +1037,7 @@ abstract class Database { final protected static function openConnection($key, $target) { global $db_prefix; - if (empty(self::$databaseInfo)) { + if (empty(self::$databaseInfo[$key])) { self::parseConnectionInfo(); } try { === modified file 'includes/registry.inc' --- includes/registry.inc 2008-11-11 22:39:58 +0000 +++ includes/registry.inc 2008-11-15 16:40:50 +0000 @@ -33,6 +33,11 @@ function _registry_rebuild() { // registry rebuild process runs. $connection_info = Database::getConnectionInfo(); $driver = $connection_info['default']['driver']; + drupal_load('module', 'system'); + require_once DRUPAL_ROOT . '/' . variable_get('cache_inc', 'includes/cache.inc'); + require_once DRUPAL_ROOT . '/includes/module.inc'; + require_once DRUPAL_ROOT . '/includes/common.inc'; + require_once DRUPAL_ROOT . '/includes/file.inc'; require_once DRUPAL_ROOT . '/includes/database/query.inc'; require_once DRUPAL_ROOT . '/includes/database/select.inc'; require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/query.inc'; === modified file 'includes/theme.inc' --- includes/theme.inc 2008-11-10 15:40:03 +0000 +++ includes/theme.inc 2008-11-15 16:33:38 +0000 @@ -1632,7 +1632,7 @@ function theme_closure($main = 0) { function theme_blocks($region) { $output = ''; - if ($list = block_list($region)) { + if ($list = module_invoke('block', 'list', $region)) { foreach ($list as $key => $block) { // $key == module_delta $output .= theme('block', $block); @@ -1782,7 +1782,7 @@ function template_preprocess(&$variables $variables['logged_in'] = FALSE; if ($variables['db_is_active'] = db_is_active() && !defined('MAINTENANCE_MODE')) { // Check for administrators. - if (user_access('access administration pages')) { + if (module_invoke('user', 'access', 'access administration pages')) { $variables['is_admin'] = TRUE; } // Flag front page status.