*
* @since 1.27
*/
-class WatchedItemStore {
+class WatchedItemStore implements StatsdAwareInterface {
const SORT_DESC = 'DESC';
const SORT_ASC = 'ASC';
/**
* @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.
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;
}