=== modified file 'includes/bootstrap.inc'
--- includes/bootstrap.inc	2009-02-25 13:49:26 +0000
+++ includes/bootstrap.inc	2009-03-01 20:57:28 +0000
@@ -360,7 +360,7 @@ function timer_stop($name) {
  *   The path of the matching directory.
  */
 function conf_path($require_settings = TRUE, $reset = FALSE) {
-  static $conf = '';
+  $conf = &drupal_static('conf_path', '');
 
   if ($conf && !$reset) {
     return $conf;
@@ -558,7 +558,7 @@ function conf_init() {
  *   The filename of the requested item.
  */
 function drupal_get_filename($type, $name, $filename = NULL) {
-  static $files = array();
+  $files = &drupal_static('drupal_get_filename', array());
 
   if (!isset($files[$type])) {
     $files[$type] = array();
@@ -727,7 +727,7 @@ function page_get_cache($retrieve) {
  *   TRUE if the item is loaded or has already been loaded.
  */
 function drupal_load($type, $name) {
-  static $files = array();
+  $files = &drupal_static('drupal_load', array());
 
   if (isset($files[$type][$name])) {
     return TRUE;
@@ -1093,7 +1093,19 @@ 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;
+  $phases = &drupal_static('drupal_bootstrap_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 = &drupal_static('drupal_bootstrap_completed_phase', -1);
 
   if (isset($phase)) {
     while ($phases && $phase > $completed_phase) {
@@ -1251,7 +1263,9 @@ function drupal_maintenance_theme() {
  */
 function get_t() {
   static $t;
-  if (is_null($t)) {
+  // This is not converted to drupal_static because there is no point in
+  // resetting this as it can not change in the course of a request.
+  if (!isset($t)) {
     $t = function_exists('install_main') ? 'st' : 't';
   }
   return $t;
@@ -1278,16 +1292,9 @@ function drupal_init_language() {
  * Get a list of languages set up indexed by the specified key
  *
  * @param $field The field to index the list with.
- * @param $reset Boolean to request a reset of the list.
  */
-function language_list($field = 'language', $reset = FALSE) {
-  static $languages = NULL;
-
-  // Reset language list
-  if ($reset) {
-    $languages = NULL;
-  }
-
+function language_list($field = 'language') {
+  $languages = &drupal_static('language_list');
   // Init language list
   if (!isset($languages)) {
     if (variable_get('language_count', 1) > 1 || module_exists('locale')) {
@@ -1340,7 +1347,7 @@ function language_default($property = NU
  *   environments.
  */
 function ip_address($reset = FALSE) {
-  static $ip_address = NULL;
+  $ip_address = &drupal_static('ip_address');
 
   if (!isset($ip_address) || $reset) {
     $ip_address = $_SERVER['REMOTE_ADDR'];
@@ -1615,3 +1622,42 @@ function registry_rebuild() {
 /**
  * @} End of "ingroup registry".
  */
+
+/**
+ * Central static facility with a reset.
+ *
+ * @param $name
+ *   Name of the static bin. It's practical to use the caller function name as
+ *   prefix or as the name itself. If NULL then every variable is reset,
+ *   this is for internal use only.
+ * @param $default
+ *   Optional default value. drupal_static_reset will reload this value. Note
+ *   that the first non-NULL value will be stored.
+ * @param $reset
+ *   TRUE to reset. Internal use only.
+ */
+function &drupal_static($name, $default = NULL, $reset = FALSE) {
+  static $data, $default;
+  if (!isset($name)) {
+    $data = $default;
+    return;
+  }
+  $new_data = !isset($default[$name]);
+  if ($new_data) {
+    $default[$name] = $default;
+  }
+  if ($new_data || $reset) {
+    $data[$name] = $default[$name];
+  }
+  return $cache[$name]['data'];
+}
+
+/**
+ * Reset one or all static variable(s).
+ *
+ * @param $name
+ *   Name of the static bin to reset. Omit to reset all variables.
+ */
+function drupal_static_reset($name = NULL) {
+  drupal_static($name, NULL, TRUE);
+}

=== modified file 'includes/install.inc'
--- includes/install.inc	2009-02-22 17:55:28 +0000
+++ includes/install.inc	2009-03-01 20:36:55 +0000
@@ -335,7 +335,8 @@ abstract class DatabaseInstaller {
  */
 function drupal_rewrite_settings($settings = array(), $prefix = '') {
   $default_settings = 'sites/default/default.settings.php';
-  $settings_file = conf_path(FALSE, TRUE) . '/' . $prefix . 'settings.php';
+  drupal_static_reset('conf_path');
+  $settings_file = conf_path(FALSE) . '/' . $prefix . 'settings.php';
 
   // Build list of setting names and insert the values into the global namespace.
   $keys = array();

=== modified file 'includes/locale.inc'
--- includes/locale.inc	2009-02-22 17:55:28 +0000
+++ includes/locale.inc	2009-03-01 20:26:47 +0000
@@ -32,7 +32,8 @@ define('LOCALE_IMPORT_KEEP', 1);
  * User interface for the language overview screen.
  */
 function locale_languages_overview_form() {
-  $languages = language_list('language', TRUE);
+  drupal_static_reset('language');
+  $languages = language_list('language');
 
   $options = array();
   $form['weight'] = array('#tree' => TRUE);
@@ -491,7 +492,8 @@ function locale_languages_configure_form
  * Overview screen for translations.
  */
 function locale_translate_overview_screen() {
-  $languages = language_list('language', TRUE);
+  drupal_static_reset('language_list');
+  $languages = language_list('language');
   $groups = module_invoke_all('locale', 'groups');
 
   // Build headers with all groups in order.
@@ -553,7 +555,8 @@ function locale_translation_filters() {
   $filters = array();
 
   // Get all languages, except English
-  $languages = locale_language_list('name', TRUE);
+  drupal_static_reset('language_list');
+  $languages = locale_language_list('name');
   unset($languages['en']);
 
   $filters['string'] = array(
@@ -675,7 +678,8 @@ function locale_translation_filter_form_
  */
 function locale_translate_import_form() {
   // Get all languages, except English
-  $names = locale_language_list('name', TRUE);
+  drupal_static_reset('language_list');
+  $names = locale_language_list('name');
   unset($names['en']);
 
   if (!count($names)) {
@@ -733,7 +737,8 @@ function locale_translate_import_form_su
   if ($file = file_save_upload('file')) {
 
     // Add language, if not yet supported
-    $languages = language_list('language', TRUE);
+    drupal_static_reset('language_list');
+    $languages = language_list('language');
     $langcode = $form_state['values']['langcode'];
     if (!isset($languages[$langcode])) {
       $predefined = _locale_get_predefined_list();
@@ -771,7 +776,8 @@ function locale_translate_import_form_su
  */
 function locale_translate_export_screen() {
   // Get all languages, except English
-  $names = locale_language_list('name', TRUE);
+  drupal_static_reset('language_list');
+  $names = locale_language_list('name');
   unset($names['en']);
   $output = '';
   // Offer translation export if any language is set up.

=== modified file 'install.php'
--- install.php	2009-02-24 16:00:01 +0000
+++ install.php	2009-03-01 20:37:35 +0000
@@ -185,7 +185,8 @@ function install_verify_settings() {
     include_once DRUPAL_ROOT . '/includes/form.inc';
 
     $database = $databases['default']['default'];
-    $settings_file = './' . conf_path(FALSE, TRUE) . '/settings.php';
+    drupal_static_reset('conf_path');
+    $settings_file = './' . conf_path(FALSE) . '/settings.php';
 
     $form_state = array();
     _install_settings_form_validate($database, $settings_file, $form_state);
@@ -202,7 +203,8 @@ function install_verify_settings() {
 function install_change_settings($profile = 'default', $install_locale = '') {
   global $databases, $db_prefix;
 
-  $conf_path = './' . conf_path(FALSE, TRUE);
+  drupal_static_reset('conf_path');
+  $conf_path = './' . conf_path(FALSE);
   $settings_file = $conf_path . '/settings.php';
   $database = isset($databases['default']['default']) ? $databases['default']['default'] : array();
 
@@ -900,7 +902,8 @@ function install_check_requirements($pro
   // If Drupal is not set up already, we need to create a settings file.
   if (!$verify) {
     $writable = FALSE;
-    $conf_path = './' . conf_path(FALSE, TRUE);
+    drupal_static_reset('conf_path');
+    $conf_path = './' . conf_path(FALSE);
     $settings_file = $conf_path . '/settings.php';
     $file = $conf_path;
     $exists = FALSE;

=== modified file 'modules/translation/translation.test'
--- modules/translation/translation.test	2008-12-30 16:43:14 +0000
+++ modules/translation/translation.test	2009-03-01 20:38:40 +0000
@@ -85,7 +85,9 @@ class TranslationTestCase extends Drupal
       $edit['langcode'] = $language_code;
       $this->drupalPost('admin/settings/language/add', $edit, t('Add language'));
 
-      $languages = language_list('language', TRUE); // Make sure we're not using a stale list.
+      // Make sure we're not using a stale list.
+      drupal_static_reset('language_list');
+      $languages = language_list('language');
       $this->assertTrue(array_key_exists($language_code, $languages), t('Language was installed successfully.'));
 
       if (array_key_exists($language_code, $languages)) {

