jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/348463 )

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


Remove usage of RequestContext::getStats()

Bug: T156810
Change-Id: Ie5e1d8b4c36e8a833092eaafeb31be0dff0f6172
---
M includes/BounceHandlerActions.php
M includes/ProcessBounceEmails.php
2 files changed, 5 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index ad0bf8f..0263c2b 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -141,6 +141,7 @@
                $bounceUserId = $failedUser['rawUserId'];
 
                $user = User::newFromId( $bounceUserId );
+               $stats = 
\MediaWiki\MediaWikiServices::getInstance()->getStatsdDataFactory();
                // Handle the central account email status (if applicable)
                if ( class_exists( 'CentralAuthUser') ) {
                        $caUser = CentralAuthUser::getInstance( $user );
@@ -152,7 +153,7 @@
                                        "Un-subscribed global user 
{$caUser->getName()} <$originalEmail> for exceeding Bounce Limit 
$this->bounceRecordLimit.\nProcessed Headers:\n" .
                                                $this->formatHeaders( 
$emailHeaders ) . "\nBounced Email: \n$this->emailRaw"
                                );
-                               
RequestContext::getMain()->getStats()->increment( 'bouncehandler.unsub.global' 
);
+                               $stats->increment( 'bouncehandler.unsub.global' 
);
                        }
                } else {
                        // Invalidate the email-id of a local user
@@ -163,7 +164,7 @@
                                "Un-subscribed {$user->getName()} 
<$originalEmail> for exceeding Bounce limit 
$this->bounceRecordLimit.\nProcessed Headers:\n" .
                                        $this->formatHeaders( $emailHeaders ). 
"\nBounced Email: \n$this->emailRaw"
                        );
-                       RequestContext::getMain()->getStats()->increment( 
'bouncehandler.unsub.local' );
+                       $stats->increment( 'bouncehandler.unsub.local' );
                }
        }
 
diff --git a/includes/ProcessBounceEmails.php b/includes/ProcessBounceEmails.php
index 1a37e1d..0fcee64 100644
--- a/includes/ProcessBounceEmails.php
+++ b/includes/ProcessBounceEmails.php
@@ -74,7 +74,8 @@
                                'br_reason' => $subject
                        );
                        $dbw->insert( 'bounce_records', $rowData, __METHOD__ );
-                       RequestContext::getMain()->getStats()->increment( 
'bouncehandler.bounces' );
+                       \MediaWiki\MediaWikiServices::getInstance()
+                               ->getStatsdDataFactory()->increment( 
'bouncehandler.bounces' );
 
                        if ( $wgBounceRecordMaxAge ) {
                                $pruneOldRecords = new PruneOldBounceRecords( 
$wgBounceRecordMaxAge );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5e1d8b4c36e8a833092eaafeb31be0dff0f6172
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: 01tonythomas <01tonytho...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to