diff options
author | addshore <addshorewiki@gmail.com> | 2016-04-02 12:18:54 +0300 |
---|---|---|
committer | Reedy <reedy@wikimedia.org> | 2016-04-02 13:02:37 +0000 |
commit | 6ae77e6984b9779775308217804c56363cbcdebb (patch) | |
tree | 9e92e42c1919417e55564d1dcfbca0f872e43648 /includes/WatchedItemStore.php | |
parent | a46cc763792f458816bf2cfd6c48125c97b96ad3 (diff) | |
download | mediawikicore-6ae77e6984b9779775308217804c56363cbcdebb.tar.gz mediawikicore-6ae77e6984b9779775308217804c56363cbcdebb.zip |
Introduce NullStatsdDataFactory
I have left the phpdocs in NullStatsdDataFactory
to clearly show the return types of the interface
implemented.
Change-Id: I96cb64b4af16fc087028269a53d539f8c132f81c
Diffstat (limited to 'includes/WatchedItemStore.php')
-rw-r--r-- | includes/WatchedItemStore.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php index 4f3d64033908..2aa294b6393a 100644 --- a/includes/WatchedItemStore.php +++ b/includes/WatchedItemStore.php @@ -57,20 +57,22 @@ class WatchedItemStore { /** * @param LoadBalancer $loadBalancer * @param HashBagOStuff $cache - * @param StatsdDataFactoryInterface $stats */ public function __construct( LoadBalancer $loadBalancer, - HashBagOStuff $cache, - StatsdDataFactoryInterface $stats + HashBagOStuff $cache ) { $this->loadBalancer = $loadBalancer; $this->cache = $cache; - $this->stats = $stats; + $this->stats = new NullStatsdDataFactory(); $this->deferredUpdatesAddCallableUpdateCallback = [ 'DeferredUpdates', 'addCallableUpdate' ]; $this->revisionGetTimestampFromIdCallback = [ 'Revision', 'getTimestampFromId' ]; } + public function setStatsdDataFactory( StatsdDataFactoryInterface $stats ) { + $this->stats = $stats; + } + /** * Overrides the DeferredUpdates::addCallableUpdate callback * This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined. @@ -155,9 +157,9 @@ class WatchedItemStore { if ( !self::$instance ) { self::$instance = new self( wfGetLB(), - new HashBagOStuff( [ 'maxKeys' => 100 ] ), - RequestContext::getMain()->getStats() + new HashBagOStuff( [ 'maxKeys' => 100 ] ) ); + self::$instance->setStatsdDataFactory( RequestContext::getMain()->getStats() ); } return self::$instance; } |