jenkins-bot has submitted this change and it was merged.

Change subject: Check if logging is enabled before logging EchoInteraction
......................................................................


Check if logging is enabled before logging EchoInteraction

Adds a check before logging a visit to Special:Notifications
added in Icfe63fb8daa8e8fba029e22b4de3e4f65517c448

Bug: T143092
Change-Id: I9e58ba35eef6a25a78e96a76facc04819cef37da
---
M includes/EventLogging.php
M includes/special/SpecialNotifications.php
2 files changed, 25 insertions(+), 13 deletions(-)

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



diff --git a/includes/EventLogging.php b/includes/EventLogging.php
index aa18536..afb162a 100644
--- a/includes/EventLogging.php
+++ b/includes/EventLogging.php
@@ -97,4 +97,28 @@
                self::actuallyLogTheEvent( 'EchoMail', $data );
        }
 
+       /**
+        * @param User $user
+        * @param string $skinName
+        */
+       public static function logEchoInteraction( User $user, $skinName ) {
+               global $wgEchoConfig;
+               if ( 
!$wgEchoConfig['eventlogging']['EchoInteraction']['enabled'] ) {
+                       return;
+               }
+
+               self::actuallyLogTheEvent(
+                       'EchoInteraction',
+                       array(
+                               'context' => 'archive',
+                               'action' => 'special-page-visit',
+                               'userId' => (int)$user->getId(),
+                               'editCount' => (int)$user->getEditCount(),
+                               'notifWiki' => wfWikiID(),
+                               // Hack: Figure out if we are in the mobile skin
+                               'mobile' => $skinName === 'minerva',
+                       )
+               );
+       }
+
 }
diff --git a/includes/special/SpecialNotifications.php 
b/includes/special/SpecialNotifications.php
index 962d061..70c503c 100644
--- a/includes/special/SpecialNotifications.php
+++ b/includes/special/SpecialNotifications.php
@@ -12,7 +12,6 @@
        }
 
        public function execute( $par ) {
-
                $this->setHeaders();
 
                $out = $this->getOutput();
@@ -160,18 +159,7 @@
                $out->addModuleStyles( array( 'ext.echo.styles.notifications', 
'ext.echo.styles.special' ) );
 
                // Log visit
-               MWEchoEventLogging::actuallyLogTheEvent(
-                       'EchoInteraction',
-                       array(
-                               'context' => 'archive',
-                               'action' => 'special-page-visit',
-                               'userId' => (int)$user->getId(),
-                               'editCount' => (int)$user->getEditCount(),
-                               'notifWiki' => wfWikiID(),
-                               // Hack: Figure out if we are in the mobile skin
-                               'mobile' => $out->getSkin()->getSkinName() === 
'minerva',
-                       )
-               );
+               MWEchoEventLogging::logEchoInteraction( $user, 
$out->getSkin()->getSkinName() );
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9e58ba35eef6a25a78e96a76facc04819cef37da
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: WMDE-leszek <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: WMDE-Fisch <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to