<?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
* @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" );
$ret = unserialize( $ret );
}
- $wgExternalBlobCache = array( $cacheID => &$ret );
+ $externalBlobCache = array( $cacheID => &$ret );
return $ret;
}