Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.272 diff -u -p -r1.272 bootstrap.inc --- includes/bootstrap.inc 18 Mar 2009 09:21:21 -0000 1.272 +++ includes/bootstrap.inc 1 Apr 2009 19:52:19 -0000 @@ -647,13 +647,9 @@ function variable_get($name, $default = * of serialization as necessary. */ function variable_set($name, $value) { - global $conf; - db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); - cache_clear_all('variables', 'cache'); - - $conf[$name] = $value; + variable_set_temporary($name, $value); } /** @@ -673,6 +669,21 @@ function variable_del($name) { unset($conf[$name]); } +/** + * Set a temporary variable. + * + * The value of the variable will persist for at most the remainder of the + * current page request. + * + * @param $name + * The name of the variable to set. + * @param $value + * The value to set. + */ +function variable_set_temporary($name, $value) { + global $conf; + $conf[$name] = $value; +} /** * Retrieve the current page from the cache. @@ -1340,7 +1351,7 @@ function language_default($property = NU * environments. */ function ip_address($reset = FALSE) { - static $ip_address = NULL; + $ip_address = variable_get('ip_address'); if (!isset($ip_address) || $reset) { $ip_address = $_SERVER['REMOTE_ADDR']; @@ -1368,6 +1379,7 @@ function ip_address($reset = FALSE) { } } + variable_set_temporary('ip_address', $ip_address); return $ip_address; }