Merge "statsd: Rename MediawikiStatsdDataFactory to IBufferingStatsdDataFactory"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 8 Jul 2017 03:26:42 +0000 (03:26 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 8 Jul 2017 03:26:42 +0000 (03:26 +0000)
autoload.php
includes/MediaWikiServices.php
includes/context/ContextSource.php
includes/context/DerivativeContext.php
includes/context/IContextSource.php
includes/context/RequestContext.php
includes/libs/stats/BufferingStatsdDataFactory.php
includes/libs/stats/IBufferingStatsdDataFactory.php [new file with mode: 0644]
includes/libs/stats/MediawikiStatsdDataFactory.php [deleted file]
includes/libs/stats/NullStatsdDataFactory.php
tests/phpunit/includes/MediaWikiServicesTest.php

index 2560bdb..88b6170 100644 (file)
@@ -604,6 +604,7 @@ $wgAutoloadLocalClasses = [
        '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',
@@ -964,7 +965,6 @@ $wgAutoloadLocalClasses = [
        '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',
index ea0ec15..84fc959 100644 (file)
@@ -9,7 +9,7 @@ use EventRelayerGroup;
 use GenderCache;
 use GlobalVarConfig;
 use Hooks;
-use MediawikiStatsdDataFactory;
+use IBufferingStatsdDataFactory;
 use Wikimedia\Rdbms\LBFactory;
 use LinkCache;
 use Wikimedia\Rdbms\LoadBalancer;
@@ -447,7 +447,7 @@ class MediaWikiServices extends ServiceContainer {
 
        /**
         * @since 1.27
-        * @return MediawikiStatsdDataFactory
+        * @return IBufferingStatsdDataFactory
         */
        public function getStatsdDataFactory() {
                return $this->getService( 'StatsdDataFactory' );
index 36d6df2..434201a 100644 (file)
@@ -170,7 +170,7 @@ abstract class ContextSource implements IContextSource {
         * @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();
index 9c3c42a..0d0c149 100644 (file)
@@ -109,7 +109,7 @@ class DerivativeContext extends ContextSource implements MutableContext {
         *
         * @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
         *
-        * @return MediawikiStatsdDataFactory
+        * @return IBufferingStatsdDataFactory
         */
        public function getStats() {
                return MediaWikiServices::getInstance()->getStatsdDataFactory();
index d13e1a5..895e9e4 100644 (file)
@@ -131,7 +131,7 @@ interface IContextSource extends MessageLocalizer {
         * @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
         *
         * @since 1.25
-        * @return MediawikiStatsdDataFactory
+        * @return IBufferingStatsdDataFactory
         */
        public function getStats();
 
index 2cabfe1..2ac4192 100644 (file)
@@ -138,7 +138,7 @@ class RequestContext implements IContextSource, MutableContext {
         *
         * @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
         *
-        * @return MediawikiStatsdDataFactory
+        * @return IBufferingStatsdDataFactory
         */
        public function getStats() {
                return MediaWikiServices::getInstance()->getStatsdDataFactory();
index f687254..73c6a8f 100644 (file)
@@ -32,7 +32,7 @@ use Liuggio\StatsdClient\Factory\StatsdDataFactory;
  *
  * @since 1.25
  */
-class BufferingStatsdDataFactory extends StatsdDataFactory implements MediawikiStatsdDataFactory {
+class BufferingStatsdDataFactory extends StatsdDataFactory implements IBufferingStatsdDataFactory {
        protected $buffer = [];
        /**
         * Collection enabled?
diff --git a/includes/libs/stats/IBufferingStatsdDataFactory.php b/includes/libs/stats/IBufferingStatsdDataFactory.php
new file mode 100644 (file)
index 0000000..64ee267
--- /dev/null
@@ -0,0 +1,30 @@
+<?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 );
+
+}
diff --git a/includes/libs/stats/MediawikiStatsdDataFactory.php b/includes/libs/stats/MediawikiStatsdDataFactory.php
deleted file mode 100644 (file)
index d560f18..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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 );
-
-}
index 4fa0248..f2e35b6 100644 (file)
@@ -8,7 +8,7 @@ use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
  * @author Addshore
  * @since 1.27
  */
-class NullStatsdDataFactory implements MediawikiStatsdDataFactory {
+class NullStatsdDataFactory implements IBufferingStatsdDataFactory {
 
        /**
         * This function creates a 'timing' StatsdData.
index 4e16258..9eae643 100644 (file)
@@ -303,7 +303,7 @@ class MediaWikiServicesTest extends MediaWikiTestCase {
                        '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 ],