jenkins-bot has submitted this change and it was merged.
Change subject: Remove ObjectCache dependency from MultiWriteBagOStuff
......................................................................
Remove ObjectCache dependency from MultiWriteBagOStuff
This brings it closer to being able to move to /libs.
Change-Id: Ia733f9023e56d4a25ffcb99ca0cc8b29cbb2ad45
---
M includes/libs/objectcache/ReplicatedBagOStuff.php
M includes/objectcache/MultiWriteBagOStuff.php
2 files changed, 17 insertions(+), 9 deletions(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/libs/objectcache/ReplicatedBagOStuff.php
b/includes/libs/objectcache/ReplicatedBagOStuff.php
index 9812047..b98c982 100644
--- a/includes/libs/objectcache/ReplicatedBagOStuff.php
+++ b/includes/libs/objectcache/ReplicatedBagOStuff.php
@@ -39,9 +39,9 @@
/**
* 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 c05ecb6..a9304c1 100644
--- a/includes/objectcache/MultiWriteBagOStuff.php
+++ b/includes/objectcache/MultiWriteBagOStuff.php
@@ -41,10 +41,9 @@
/**
* $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 @@
$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';
--
To view, visit https://gerrit.wikimedia.org/r/244641
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia733f9023e56d4a25ffcb99ca0cc8b29cbb2ad45
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits