? .install.php.swp ? drushrc.php ? includes/.bootstrap.inc.swp ? includes/.common.inc.swp ? includes/.install.inc.swp ? sites/head.dev ? sites/default/files Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.190 diff -u -r1.190 install.php --- install.php 30 Jul 2009 19:32:19 -0000 1.190 +++ install.php 30 Jul 2009 20:30:04 -0000 @@ -269,7 +269,7 @@ // This is important, as the installer calls into the Drupal system for // the clean URL checks, so we should maintain the cache properly. require_once DRUPAL_ROOT . '/includes/cache.inc'; - $conf['cache_inc'] = 'includes/cache.inc'; + variable_set('cache_inc', 'includes/cache.inc', 'runtime'); // Initialize the database system. Note that the connection // won't be initialized until it is actually requested. @@ -284,7 +284,7 @@ // system with a stubbed-out version that short-circuits the actual // caching process and avoids any errors. require_once DRUPAL_ROOT . '/includes/cache-install.inc'; - $conf['cache_inc'] = 'includes/cache-install.inc'; + variable_set('cache_inc', 'includes/cache-install.inc', 'runtime'); $task = NULL; Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.292 diff -u -r1.292 bootstrap.inc --- includes/bootstrap.inc 28 Jul 2009 12:13:46 -0000 1.292 +++ includes/bootstrap.inc 30 Jul 2009 20:30:06 -0000 @@ -588,6 +588,11 @@ ini_set('session.cookie_domain', $cookie_domain); } session_name('SESS' . md5($session_name)); + + + if (is_array($conf)) { + variable_set_realm('runtime', $conf); + } } /** @@ -665,7 +670,9 @@ * with variable_set() as well as those explicitly specified in the configuration * file. */ -function variable_initialize($conf = array()) { +function variable_initialize() { + global $conf; + // NOTE: caching the variables improves performance by 20% when serving cached pages. if ($cached = cache_get('variables', 'cache')) { $variables = $cached->data; @@ -675,9 +682,7 @@ cache_set('variables', $variables); } - foreach ($conf as $name => $value) { - $variables[$name] = $value; - } + variable_set_realm('database', $variables); return $variables; } @@ -692,10 +697,25 @@ * @return * The value of the variable. */ -function variable_get($name, $default = NULL) { - global $conf; +function variable_get($name, $default = NULL, $realm = null) { + $cache = &drupal_static('variable_cache', array()); + if (is_null($realm)) { + if (isset($cache['runtime'][$name])) { + return $cache['runtime'][$name]; + } + elseif (isset($cache['database'][$name])) { + return $cache['database'][$name]; + } + elseif (isset($cache['defaults'][$name])) { + return $cache['defaults'][$name]; + } + } else { + if (isset($cache[$realm][$name])) { + return $cache[$realm][$name]; + } + } - return isset($conf[$name]) ? $conf[$name] : $default; + return $default; } /** @@ -707,14 +727,26 @@ * The value to set. This can be any PHP data type; these functions take care * of serialization as necessary. */ -function variable_set($name, $value) { - global $conf; +function variable_set($name, $value, $realm = 'database') { + + $cache = &drupal_static('variable_cache', array()); - db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); + if ($realm == 'database') { + db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); - cache_clear_all('variables', 'cache'); + cache_clear_all('variables', 'cache'); + } - $conf[$name] = $value; + $cache[$realm][$name] = $value; +} + +/** + * Populate a variable 'realm' + */ +function variable_set_realm($realm, $conf) { + $cache = &drupal_static('variable_cache', array()); + + $cache[$realm] = $conf; } /** @@ -723,15 +755,17 @@ * @param $name * The name of the variable to undefine. */ -function variable_del($name) { - global $conf; +function variable_del($name, $realm = 'database') { + $cache = &drupal_static('variable_cache'); - db_delete('variable') - ->condition('name', $name) - ->execute(); - cache_clear_all('variables', 'cache'); + if ($realm == 'database') { + db_delete('variable') + ->condition('name', $name) + ->execute(); + cache_clear_all('variables', 'cache'); + } - unset($conf[$name]); + unset($cache[$realm][$name]); } /** @@ -1434,7 +1468,7 @@ case DRUPAL_BOOTSTRAP_VARIABLES: // Load variables from the database, but do not overwrite variables set in settings.php. - $conf = variable_initialize(isset($conf) ? $conf : array()); + variable_initialize(); break; case DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE: Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.949 diff -u -r1.949 common.inc --- includes/common.inc 30 Jul 2009 19:57:09 -0000 1.949 +++ includes/common.inc 30 Jul 2009 20:30:14 -0000 @@ -3488,11 +3488,16 @@ module_load_all(); // Make sure all stream wrappers are registered. file_get_stream_wrappers(); + + $defaults = module_invoke_all('variable_defaults'); + variable_set_realm('defaults', $defaults); + // Let all modules take action before menu system handles the request // We do not want this while running update.php. if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') { module_invoke_all('init'); } + } /**