X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/cc7b1505cd9fafd87c3672f669e13e98b0c544f7..022dfbbbe3215917d84708eb09acca93b21ae9e0:/wp-includes/cache.php diff --git a/wp-includes/cache.php b/wp-includes/cache.php index 79a0566b..334a9610 100644 --- a/wp-includes/cache.php +++ b/wp-includes/cache.php @@ -8,6 +8,8 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) { function wp_cache_close() { global $wp_object_cache; + if ( ! isset($wp_object_cache) ) + return; return $wp_object_cache->save(); } @@ -30,9 +32,7 @@ function wp_cache_get($id, $flag = '') { } function wp_cache_init() { - global $wp_object_cache; - - $wp_object_cache = new WP_Object_Cache(); + $GLOBALS['wp_object_cache'] =& new WP_Object_Cache(); } function wp_cache_replace($key, $data, $flag = '', $expire = 0) { @@ -404,8 +404,14 @@ class WP_Object_Cache { } function WP_Object_Cache() { + return $this->__construct(); + } + + function __construct() { global $blog_id; + register_shutdown_function(array(&$this, "__destruct")); + if (defined('DISABLE_CACHE')) return; @@ -440,5 +446,10 @@ class WP_Object_Cache { $this->blog_id = $this->hash($blog_id); } + + function __destruct() { + $this->save(); + return true; + } } ?>