From: jenkins-bot Date: Tue, 20 Oct 2015 00:55:33 +0000 (+0000) Subject: Merge "Update ResourceLoader for Ib7fc2f939b" X-Git-Tag: 1.31.0-rc.0~9342 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=577ddabd01f9d16d5ca4fc71829a93d4cc7bb907;hp=e2547a73c922f15ac18dd2b3b4d3298b7339f080 Merge "Update ResourceLoader for Ib7fc2f939b" --- diff --git a/includes/libs/objectcache/ReplicatedBagOStuff.php b/includes/libs/objectcache/ReplicatedBagOStuff.php index 98120477d3..b98c982e6f 100644 --- a/includes/libs/objectcache/ReplicatedBagOStuff.php +++ b/includes/libs/objectcache/ReplicatedBagOStuff.php @@ -39,9 +39,9 @@ class ReplicatedBagOStuff extends BagOStuff { /** * Constructor. Parameters are: - * - writeFactory : ObjectFactory::getObjectFromSpec parameters yeilding BagOStuff. + * - writeFactory : ObjectFactory::getObjectFromSpec array yeilding BagOStuff. * This object will be used for writes (e.g. the master DB). - * - readFactory : ObjectFactory::getObjectFromSpec parameters yeilding BagOStuff. + * - readFactory : ObjectFactory::getObjectFromSpec array yeilding BagOStuff. * This object will be used for reads (e.g. a slave DB). * * @param array $params diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php index c05ecb6d79..a9304c1d9a 100644 --- a/includes/objectcache/MultiWriteBagOStuff.php +++ b/includes/objectcache/MultiWriteBagOStuff.php @@ -41,10 +41,9 @@ class MultiWriteBagOStuff extends BagOStuff { /** * $params include: - * - caches: This should have a numbered array of cache parameter - * structures, in the style required by $wgObjectCaches. See - * the documentation of $wgObjectCaches for more detail. - * BagOStuff objects can also be used as values. + * - caches: A numbered array of either ObjectFactory::getObjectFromSpec + * arrays yeilding BagOStuff objects or direct BagOStuff objects. + * If using the former, the 'args' field *must* be set. * The first cache is the primary one, being the first to * be read in the fallback chain. Writes happen to all stores * in the order they are defined. However, lock()/unlock() calls @@ -72,9 +71,18 @@ class MultiWriteBagOStuff extends BagOStuff { $this->caches = array(); foreach ( $params['caches'] as $cacheInfo ) { - $this->caches[] = ( $cacheInfo instanceof BagOStuff ) - ? $cacheInfo - : ObjectCache::newFromParams( $cacheInfo ); + if ( $cacheInfo instanceof BagOStuff ) { + $this->caches[] = $cacheInfo; + } else { + if ( !isset( $cacheInfo['args'] ) ) { + // B/C for when $cacheInfo was for ObjectCache::newFromParams(). + // Callers intenting this to be for ObjectFactory::getObjectFromSpec + // should have set "args" per the docs above. Doings so avoids extra + // (likely harmless) params (factory/class/calls) ending up in "args". + $cacheInfo['args'] = array( $cacheInfo ); + } + $this->caches[] = ObjectFactory::getObjectFromSpec( $cacheInfo ); + } } $this->asyncWrites = isset( $params['replication'] ) && $params['replication'] === 'async';