CSteipp has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/76829


Change subject: Add eventlogging for SUL2 activity
......................................................................

Add eventlogging for SUL2 activity

Log when we attempt to autologin users, and when the user is logged in
by the central check, so we can determine how many users are not being
auto logged in correctly.

Change-Id: I2ae7c85cff6d936e35fca7422ba4f254dcd5cc9c
---
M CentralAuth.php
M CentralAuthHooks.php
M specials/SpecialCentralAutoLogin.php
3 files changed, 26 insertions(+), 1 deletion(-)


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

diff --git a/CentralAuth.php b/CentralAuth.php
index 6049e63..1799d4e 100644
--- a/CentralAuth.php
+++ b/CentralAuth.php
@@ -218,6 +218,11 @@
 $wgCentralAuthReadOnly = false;
 
 /**
+ * Use the EventLogging extention to measure various activities
+ */
+$wgCentralAuthUseEventLogging = false;
+
+/**
  * Initialization of the autoloaders, and special extension pages.
  */
 $caBase = __DIR__;
diff --git a/CentralAuthHooks.php b/CentralAuthHooks.php
index 02079dc..585c5c1 100644
--- a/CentralAuthHooks.php
+++ b/CentralAuthHooks.php
@@ -1013,7 +1013,7 @@
         * @return bool
         */
        static function onBeforePageDisplay( &$out, &$skin ) {
-               global $wgCentralAuthLoginWiki;
+               global $wgCentralAuthLoginWiki, $wgCentralAuthUseEventLogging;
                if ( $out->getUser()->isAnon() ) {
                        if ( $wgCentralAuthLoginWiki && wfWikiID() !== 
$wgCentralAuthLoginWiki ) {
                                $out->addModules( 
'ext.centralauth.centralautologin' );
@@ -1077,6 +1077,17 @@
                                                ) );
                                        }
                                }
+
+                               if ( $wgCentralAuthUseEventLogging ) {
+                                       // Need to corrolate user_id across 
wikis
+                                       $centralUser = 
CentralAuthUser::getInstance( $out->getUser() );
+                                       efLogServerSideEvent( 'CentralAuth', 
5690875,
+                                               array( 'version'=>1,
+                                                       'userId' => 
$centralUser->getId(),
+                                                       
'action'=>'sul2-autologin-login'
+                                               )
+                                       );
+                               }
                        }
                }
                return true;
diff --git a/specials/SpecialCentralAutoLogin.php 
b/specials/SpecialCentralAutoLogin.php
index ed500f3..a37ac45 100644
--- a/specials/SpecialCentralAutoLogin.php
+++ b/specials/SpecialCentralAutoLogin.php
@@ -300,6 +300,15 @@
                        }
 
                        // Otherwise, we need to rewrite p-personal and maybe 
notify the user too
+                       global $wgCentralAuthUseEventLogging;
+                       if ( $wgCentralAuthUseEventLogging ) {
+                               efLogServerSideEvent( 'CentralAuth', 5690875,
+                                       array( 'version'=>1,
+                                               'userId' => 
$centralUser->getId(),
+                                               
'action'=>'sul2-autologin-fallbacklogin'
+                                       )
+                               );
+                       }
 
                        // This is hacky, and may not work right with all skins 
and
                        // other extensions.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ae7c85cff6d936e35fca7422ba4f254dcd5cc9c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: CSteipp <[email protected]>

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

Reply via email to