Follows-up I2874175647e (
7fdc3d09a3b).
* Avoid "MediaWiki" in class names. If unavoidable, always camelcase.
* Use a more descriptive name, matching the implementing the class ("Buffering").
* Use "I" prefix for consistency with other MediaWiki-provided interfaces.
(Avoid "Interface" suffix, which is foreign to MediaWiki and is only used
in the StatsdClient namespace, which this interface is not in).
Bug: T166354
Change-Id: I06de59122625f9c23e7c1a1bfa69a7ddabbf379e
'HttpError' => __DIR__ . '/includes/exception/HttpError.php',
'HttpStatus' => __DIR__ . '/includes/libs/HttpStatus.php',
'IApiMessage' => __DIR__ . '/includes/api/ApiMessage.php',
+ 'IBufferingStatsdDataFactory' => __DIR__ . '/includes/libs/stats/IBufferingStatsdDataFactory.php',
'ICacheHelper' => __DIR__ . '/includes/cache/CacheHelper.php',
'IContextSource' => __DIR__ . '/includes/context/IContextSource.php',
'IDBAccessObject' => __DIR__ . '/includes/dao/IDBAccessObject.php',
'MediaWiki\\Widget\\TitleInputWidget' => __DIR__ . '/includes/widget/TitleInputWidget.php',
'MediaWiki\\Widget\\UserInputWidget' => __DIR__ . '/includes/widget/UserInputWidget.php',
'MediaWiki\\Widget\\UsersMultiselectWidget' => __DIR__ . '/includes/widget/UsersMultiselectWidget.php',
- 'MediawikiStatsdDataFactory' => __DIR__ . '/includes/libs/stats/MediawikiStatsdDataFactory.php',
'MemCachedClientforWiki' => __DIR__ . '/includes/compat/MemcachedClientCompat.php',
'MemcLockManager' => __DIR__ . '/includes/libs/lockmanager/MemcLockManager.php',
'MemcachedBagOStuff' => __DIR__ . '/includes/libs/objectcache/MemcachedBagOStuff.php',
use GenderCache;
use GlobalVarConfig;
use Hooks;
-use MediawikiStatsdDataFactory;
+use IBufferingStatsdDataFactory;
use Wikimedia\Rdbms\LBFactory;
use LinkCache;
use Wikimedia\Rdbms\LoadBalancer;
/**
* @since 1.27
- * @return MediawikiStatsdDataFactory
+ * @return IBufferingStatsdDataFactory
*/
public function getStatsdDataFactory() {
return $this->getService( 'StatsdDataFactory' );
* @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
*
* @since 1.25
- * @return MediawikiStatsdDataFactory
+ * @return IBufferingStatsdDataFactory
*/
public function getStats() {
return MediaWikiServices::getInstance()->getStatsdDataFactory();
*
* @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
*
- * @return MediawikiStatsdDataFactory
+ * @return IBufferingStatsdDataFactory
*/
public function getStats() {
return MediaWikiServices::getInstance()->getStatsdDataFactory();
* @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
*
* @since 1.25
- * @return MediawikiStatsdDataFactory
+ * @return IBufferingStatsdDataFactory
*/
public function getStats();
*
* @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
*
- * @return MediawikiStatsdDataFactory
+ * @return IBufferingStatsdDataFactory
*/
public function getStats() {
return MediaWikiServices::getInstance()->getStatsdDataFactory();
*
* @since 1.25
*/
-class BufferingStatsdDataFactory extends StatsdDataFactory implements MediawikiStatsdDataFactory {
+class BufferingStatsdDataFactory extends StatsdDataFactory implements IBufferingStatsdDataFactory {
protected $buffer = [];
/**
* Collection enabled?
--- /dev/null
+<?php
+use Liuggio\StatsdClient\Entity\StatsdData;
+use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
+
+/**
+ * MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
+ *
+ * @see BufferingStatsdDataFactory
+ */
+interface IBufferingStatsdDataFactory extends StatsdDataFactoryInterface {
+ /**
+ * Check whether this data factory has any data.
+ * @return boolean
+ */
+ public function hasData();
+
+ /**
+ * Return data from the factory.
+ * @return StatsdData[]
+ */
+ public function getData();
+
+ /**
+ * Set collection enable status.
+ * @param bool $enabled Will collection be enabled?
+ * @return void
+ */
+ public function setEnabled( $enabled );
+
+}
+++ /dev/null
-<?php
-use Liuggio\StatsdClient\Entity\StatsdData;
-use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
-
-/**
- * Mediawiki adaptation of Statsd data factory.
- */
-interface MediawikiStatsdDataFactory extends StatsdDataFactoryInterface {
- /**
- * Check whether this data factory has any data.
- * @return boolean
- */
- public function hasData();
-
- /**
- * Return data from the factory.
- * @return StatsdData[]
- */
- public function getData();
-
- /**
- * Set collection enable status.
- * @param bool $enabled Will collection be enabled?
- * @return void
- */
- public function setEnabled( $enabled );
-
-}
* @author Addshore
* @since 1.27
*/
-class NullStatsdDataFactory implements MediawikiStatsdDataFactory {
+class NullStatsdDataFactory implements IBufferingStatsdDataFactory {
/**
* This function creates a 'timing' StatsdData.
'MainConfig' => [ 'MainConfig', Config::class ],
'SiteStore' => [ 'SiteStore', SiteStore::class ],
'SiteLookup' => [ 'SiteLookup', SiteLookup::class ],
- 'StatsdDataFactory' => [ 'StatsdDataFactory', MediawikiStatsdDataFactory::class ],
+ 'StatsdDataFactory' => [ 'StatsdDataFactory', IBufferingStatsdDataFactory::class ],
'InterwikiLookup' => [ 'InterwikiLookup', InterwikiLookup::class ],
'EventRelayerGroup' => [ 'EventRelayerGroup', EventRelayerGroup::class ],
'SearchEngineFactory' => [ 'SearchEngineFactory', SearchEngineFactory::class ],