=== modified file 'includes/bootstrap.inc'--- includes/bootstrap.inc +++ includes/bootstrap.inc @@ -28,6 +28,9 @@ define('DRUPAL_BOOTSTRAP_FULL', 6); define('DRUPAL_ANONYMOUS_RID', 1); define('DRUPAL_AUTHENTICATED_RID', 2);+define('VARIABLE_NOT_CACHED', 0);+define('VARIABLE_CACHED', 1);+ /** * Start the timer with the specified name. If you start and stop * the same timer multiple times, the measured intervals will be*/@@ -244,7 +247,7 @@ function variable_init($conf = array()) $variables = unserialize($cached->data); } else {- $result = db_query('SELECT * FROM {variable}');+ $result = db_query('SELECT * FROM {variable} WHERE status = %d', VARIABLE_CACHED); while ($variable = db_fetch_object($result)) { $variables[$variable->name] = unserialize($variable->value); }@@ -265,12 +268,19 @@ function variable_init($conf = array()) * The name of the variable to return. * @param $default * The default value to use if this variable has never been set.+ * @param $cached+ * Boolean value which determines if this variable can be retrieved from the variable cache. * @return * The value of the variable. */-function variable_get($name, $default) {+function variable_get($name, $default, $cached = TRUE) { global $conf;+ if (!$cached) {+ if ($value = db_result(db_query("SELECT value FROM {variable} WHERE name = '%s'", $name))) {+ $conf[$name] = unserialize($value);+ }+ } return isset($conf[$name]) ? $conf[$name] : $default; }@@ -282,13 +292,17 @@ function variable_get($name, $default) { * @param $value * The value to set. This can be any PHP data type; these functions take care * of serialization as necessary.+ * @param $cached+ * Boolean value which determines if this variable will be placed into the variable cache. */-function variable_set($name, $value) {+function variable_set($name, $value, $cached = TRUE) { global $conf;+ $status = $cached ? VARIABLE_CACHED : VARIABLE_NOT_CACHED;+ db_lock_table('variable'); db_query("DELETE FROM {variable} WHERE name = '%s'", $name);- db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));+ db_query("INSERT INTO {variable} (name, value, status) VALUES ('%s', '%s', %d)", $name, serialize($value), $status); db_unlock_tables(); cache_clear_all('variables');