]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - includes/ExternalStoreDB.php
MediaWiki 1.17.0
[autoinstalls/mediawiki.git] / includes / ExternalStoreDB.php
index 769c64da0a12f1da01971b04ba9cb07273851e74..877277a2806c15318b7e40dfcfddd7c3e7c7a31e 100644 (file)
@@ -1,25 +1,5 @@
 <?php
 
-/**
- * External database storage will use one (or more) separate connection pools
- * from what the main wiki uses. If we load many revisions, such as when doing
- * bulk backups or maintenance, we want to keep them around over the lifetime
- * of the script.
- *
- * Associative array of LoadBalancer objects, indexed by cluster name.
- */
-global $wgExternalLoadBalancers;
-$wgExternalLoadBalancers = array();
-
-/**
- * One-step cache variable to hold base blobs; operations that
- * pull multiple revisions may often pull multiple times from
- * the same blob. By keeping the last-used one open, we avoid
- * redundant unserialization and decompression overhead.
- */
-global $wgExternalBlobCache;
-$wgExternalBlobCache = array();
-
 /**
  * DB accessable external objects
  * @ingroup ExternalStorage
@@ -113,11 +93,18 @@ class ExternalStoreDB {
         * @private
         */
        function &fetchBlob( $cluster, $id, $itemID ) {
-               global $wgExternalBlobCache;
+               /**
+                * One-step cache variable to hold base blobs; operations that
+                * pull multiple revisions may often pull multiple times from
+                * the same blob. By keeping the last-used one open, we avoid
+                * redundant unserialization and decompression overhead.
+                */
+               static $externalBlobCache = array();
+
                $cacheID = ( $itemID === false ) ? "$cluster/$id" : "$cluster/$id/";
-               if( isset( $wgExternalBlobCache[$cacheID] ) ) {
+               if( isset( $externalBlobCache[$cacheID] ) ) {
                        wfDebug( "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
-                       return $wgExternalBlobCache[$cacheID];
+                       return $externalBlobCache[$cacheID];
                }
 
                wfDebug( "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" );
@@ -138,7 +125,7 @@ class ExternalStoreDB {
                        $ret = unserialize( $ret );
                }
 
-               $wgExternalBlobCache = array( $cacheID => &$ret );
+               $externalBlobCache = array( $cacheID => &$ret );
                return $ret;
        }