Florianschmidtwelzow has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348464 )

Change subject: Remove usage of RequestContext::getStats()
......................................................................

Remove usage of RequestContext::getStats()

Bug: T156810
Change-Id: I2a4ca276b152ee0271ad14921436f9fc1a291541
---
M includes/CentralAuthPlugin.php
M includes/CentralAuthPrimaryAuthenticationProvider.php
M includes/CentralAuthUtils.php
3 files changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth 
refs/changes/64/348464/1

diff --git a/includes/CentralAuthPlugin.php b/includes/CentralAuthPlugin.php
index d531601..08367f6 100644
--- a/includes/CentralAuthPlugin.php
+++ b/includes/CentralAuthPlugin.php
@@ -63,7 +63,7 @@
                                        wfDebugLog( 'CentralAuth',
                                                "CentralAuthMigration: Checking 
for migration of '{$username}' to '{$renamedUsername}'"
                                        );
-                                       
RequestContext::getMain()->getStats()->increment(
+                                       
\MediaWiki\MediaWikiServices::getInstance()->getStatsdDataFactory()->increment(
                                                'centralauth.migration.check'
                                        );
 
@@ -202,7 +202,7 @@
                        wfDebugLog( 'CentralAuth',
                                "CentralAuthMigration: Coercing user to 
'{$this->sulMigrationName}'"
                        );
-                       RequestContext::getMain()->getStats()->increment(
+                       
\MediaWiki\MediaWikiServices::getInstance()->getStatsdDataFactory()->increment(
                                'centralauth.migration.coerce'
                        );
 
diff --git a/includes/CentralAuthPrimaryAuthenticationProvider.php 
b/includes/CentralAuthPrimaryAuthenticationProvider.php
index 4b87861..9266e09 100644
--- a/includes/CentralAuthPrimaryAuthenticationProvider.php
+++ b/includes/CentralAuthPrimaryAuthenticationProvider.php
@@ -142,7 +142,8 @@
                                                        'newname' => 
$renamedUsername,
                                                ]
                                        );
-                                       
RequestContext::getMain()->getStats()->increment( 'centralauth.migration.check' 
);
+                                       
\MediaWiki\MediaWikiServices::getInstance()
+                                               
->getStatsdDataFactory()->increment( 'centralauth.migration.check' );
 
                                        if ( $renamed->authenticate( 
$req->password ) === 'ok' ) {
                                                // At this point the user will 
be passed, so set the
diff --git a/includes/CentralAuthUtils.php b/includes/CentralAuthUtils.php
index d649afc..9f69742 100644
--- a/includes/CentralAuthUtils.php
+++ b/includes/CentralAuthUtils.php
@@ -181,7 +181,8 @@
                $stime = microtime( true );
                $data = CentralAuthUtils::getSessionCache()->get( $key ) ?: 
array();
                $real = microtime( true ) - $stime;
-               RequestContext::getMain()->getStats()->timing( 
'centralauth.session.read', $real );
+               \MediaWiki\MediaWikiServices::getInstance()
+                       ->getStatsdDataFactory()->timing( 
'centralauth.session.read', $real );
                return $data;
        }
 
@@ -217,7 +218,8 @@
                        $stime = microtime( true );
                        CentralAuthUtils::getSessionCache()->set( $key, $data, 
86400 );
                        $real = microtime( true ) - $stime;
-                       RequestContext::getMain()->getStats()->timing( 
'centralauth.session.write', $real );
+                       \MediaWiki\MediaWikiServices::getInstance()
+                               ->getStatsdDataFactory()->timing( 
'centralauth.session.write', $real );
                }
 
                if ( $session ) {
@@ -242,7 +244,8 @@
                        $stime = microtime( true );
                        CentralAuthUtils::getSessionCache()->delete( $key );
                        $real = microtime( true ) - $stime;
-                       RequestContext::getMain()->getStats()->timing( 
"centralauth.session.delete", $real );
+                       \MediaWiki\MediaWikiServices::getInstance()
+                               ->getStatsdDataFactory()->timing( 
"centralauth.session.delete", $real );
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/348464
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a4ca276b152ee0271ad14921436f9fc1a291541
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to