Merge "Remove usages of RequestContext::getStats()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 24 Apr 2017 20:01:55 +0000 (20:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 24 Apr 2017 20:01:55 +0000 (20:01 +0000)
includes/GlobalFunctions.php

index 8b857ea..4325328 100644 (file)
@@ -27,6 +27,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 use Liuggio\StatsdClient\Sender\SocketSender;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\Session\SessionManager;
+use MediaWiki\MediaWikiServices;
 use Wikimedia\ScopedCallback;
 use Wikimedia\Rdbms\DBReplicationWaitError;
 
@@ -1198,7 +1199,9 @@ function wfLogProfilingData() {
                        $statsdSender = new SocketSender( $statsdHost, $statsdPort );
                        $statsdClient = new SamplingStatsdClient( $statsdSender, true, false );
                        $statsdClient->setSamplingRates( $config->get( 'StatsdSamplingRates' ) );
-                       $statsdClient->send( $context->getStats()->getBuffer() );
+                       $statsdClient->send(
+                               MediaWikiServices::getInstance()->getStatsdDataFactory()->getBuffer()
+                       );
                } catch ( Exception $ex ) {
                        MWExceptionHandler::logException( $ex );
                }
@@ -1263,7 +1266,7 @@ function wfLogProfilingData() {
  * @return void
  */
 function wfIncrStats( $key, $count = 1 ) {
-       $stats = RequestContext::getMain()->getStats();
+       $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
        $stats->updateCount( $key, $count );
 }