=== modified file 'includes/bootstrap.inc'
--- includes/bootstrap.inc	2008-04-14 17:48:33 +0000
+++ includes/bootstrap.inc	2008-05-04 10:59:42 +0000
@@ -223,32 +223,28 @@ function timer_stop($name) {
  *   will be recognized. Defaults to TRUE. During initial installation,
  *   this is set to FALSE so that Drupal can detect a matching directory,
  *   then create a new settings.php file in it.
- * @param reset
- *   Force a full search for matching directories even if one had been
- *   found previously.
+ *
  * @return
  *   The path of the matching directory.
  */
-function conf_path($require_settings = TRUE, $reset = FALSE) {
-  static $conf = '';
-
-  if ($conf && !$reset) {
-    return $conf;
-  }
+function conf_path($require_settings = TRUE) {
+  $conf = &drupal_static('conf_path', '');
 
-  $confdir = 'sites';
-  $uri = explode('/', $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']);
-  $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
-  for ($i = count($uri) - 1; $i > 0; $i--) {
-    for ($j = count($server); $j > 0; $j--) {
-      $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
-      if (file_exists("$confdir/$dir/settings.php") || (!$require_settings && file_exists("$confdir/$dir"))) {
-        $conf = "$confdir/$dir";
-        return $conf;
+  if (!$conf) {
+    $confdir = 'sites';
+    $uri = explode('/', $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']);
+    $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
+    for ($i = count($uri) - 1; $i > 0; $i--) {
+      for ($j = count($server); $j > 0; $j--) {
+        $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
+        if (file_exists("$confdir/$dir/settings.php") || (!$require_settings && file_exists("$confdir/$dir"))) {
+          $conf = "$confdir/$dir";
+          return $conf;
+        }
       }
     }
+    $conf = "$confdir/default";
   }
-  $conf = "$confdir/default";
   return $conf;
 }
 
@@ -368,7 +364,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();
@@ -537,7 +533,7 @@ function bootstrap_invoke_all($hook) {
  *   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;
@@ -910,7 +906,8 @@ function drupal_anonymous_user($session 
  *     DRUPAL_BOOTSTRAP_FULL: Drupal is fully loaded, validate and fix input data.
  */
 function drupal_bootstrap($phase) {
-  static $phases = array(DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL), $phase_index = 0;
+  $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_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL));
+  $phase_index = &drupal_static('drupal_bootstrap_phase_index', 0);
 
   while ($phase >= $phase_index && isset($phases[$phase_index])) {
     $current_phase = $phases[$phase_index];
@@ -1027,11 +1024,7 @@ function drupal_maintenance_theme() {
  * run both during installation and normal operation.
  */
 function get_t() {
-  static $t;
-  if (is_null($t)) {
-    $t = function_exists('install_main') ? 'st' : 't';
-  }
-  return $t;
+  return drupal_static('get_t', function_exists('install_main') ? 'st' : 't');
 }
 
 /**
@@ -1055,16 +1048,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')) {
@@ -1116,7 +1102,7 @@ function language_default($property = NU
  *   IP address of client machine, adjusted for reverse proxy.
  */
 function ip_address() {
-  static $ip_address = NULL;
+  $ip_address = &drupal_static('ip_address');
 
   if (!isset($ip_address)) {
     $ip_address = $_SERVER['REMOTE_ADDR'];
@@ -1134,3 +1120,38 @@ function ip_address() {
 
   return $ip_address;
 }
+
+/**
+ * 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.
+ * @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 $cache;
+  // Store the default, if not yet set to a non-NULL value.
+  if (!isset($cache[$name]['default'])) {
+    $cache[$name]['default'] = $default;
+    $cache[$name]['data'] = $default;
+  }
+  elseif ($reset) {
+    $cache[$name]['data'] = $cache[$name]['default'];
+  }
+  return $cache[$name]['data'];
+}
+
+/**
+ * Central static facility reset method.
+ *
+ * @param $name
+ *   Name of the static bin to reset.
+ */
+function drupal_static_reset($name) {
+  drupal_static($name, NULL, TRUE);
+}

=== modified file 'includes/install.inc'
--- includes/install.inc	2008-04-16 11:35:51 +0000
+++ includes/install.inc	2008-05-04 10:31:04 +0000
@@ -173,7 +173,8 @@ function drupal_detect_database_types() 
  */
 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	2008-04-14 17:48:33 +0000
+++ includes/locale.inc	2008-05-04 10:34:04 +0000
@@ -29,7 +29,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);
@@ -482,7 +483,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.
@@ -536,7 +538,8 @@ function locale_translate_seek_screen() 
  */
 function locale_translate_seek_form() {
   // Get all languages, except English
-  $languages = locale_language_list('name', TRUE);
+  drupal_static_reset('language_list');
+  $languages = locale_language_list('name');
   unset($languages['en']);
 
   // Present edit form preserving previous user settings
@@ -589,7 +592,8 @@ function locale_translate_seek_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)) {
@@ -647,7 +651,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();
@@ -684,7 +689,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	2008-04-14 17:48:33 +0000
+++ install.php	2008-05-04 10:57:41 +0000
@@ -159,7 +159,8 @@ function install_verify_settings() {
     $db_host = urldecode($url['host']);
     $db_port = isset($url['port']) ? urldecode($url['port']) : '';
     $db_path = ltrim(urldecode($url['path']), '/');
-    $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($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_port, $db_path, $settings_file, $form_state);
@@ -182,8 +183,8 @@ function install_change_settings($profil
   $db_host = isset($url['host']) ? urldecode($url['host']) : '';
   $db_port = isset($url['port']) ? urldecode($url['port']) : '';
   $db_path = ltrim(urldecode($url['path']), '/');
-  $conf_path = './' . conf_path(FALSE, TRUE);
-  $settings_file = $conf_path . '/settings.php';
+  drupal_static_reset('conf_path');
+  $settings_file = './' . conf_path(FALSE) . '/settings.php';
 
   // We always need this because we want to run form_get_errors.
   include_once './includes/form.inc';
@@ -866,7 +867,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;
     // Verify that the directory exists.

=== modified file 'modules/translation/translation.test'
--- modules/translation/translation.test	2008-04-20 18:23:21 +0000
+++ modules/translation/translation.test	2008-05-04 10:35:29 +0000
@@ -87,7 +87,8 @@ 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 not using cached version
+      drupal_static_reset('language_list');
+      $languages = language_list();
       $this->assertTrue(array_key_exists($language_code, $languages), t('Language was installed successfully.'));
 
       if (array_key_exists($language_code, $languages)) {
@@ -108,7 +109,7 @@ class TranslationTestCase extends Drupal
    *
    * @param string $title Title of page in specified language.
    * @param string $body Body of page in specified language.
-   * @param string $language Langauge code.
+   * @param string $language Language code.
    */
   function createPage($title, $body, $language) {
     $edit = array();
@@ -131,7 +132,7 @@ class TranslationTestCase extends Drupal
    * @param integer $nid Node id of page to create translation for.
    * @param string $title Title of page in specified language.
    * @param string $body Body of page in specified language.
-   * @param string $language Langauge code.
+   * @param string $language Language code.
    */
   function createTranslation($nid, $title, $body, $language) {
     $this->drupalGet('node/add/page', array('query' => array('translation' => $nid, 'language' => $language)));

