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

Change subject: BSWhoIsOnline: Moved inserTrace from BeforeInitialize to 
ParserFirstCallInit
......................................................................


BSWhoIsOnline: Moved inserTrace from BeforeInitialize to ParserFirstCallInit

* Using BeforeInitialize loads the user way earlier than intended, what
causes problems with some authentification extensions. Using
ParserFirstCallInit should work as well.

=> Needs cherry-pick to REL1_27

Change-Id: I97c73e31c91983fb3b14c63eff05d3f324c9288f
---
M WhoIsOnline/WhoIsOnline.class.php
1 file changed, 13 insertions(+), 20 deletions(-)

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



diff --git a/WhoIsOnline/WhoIsOnline.class.php 
b/WhoIsOnline/WhoIsOnline.class.php
index 4551d92..a20d473 100644
--- a/WhoIsOnline/WhoIsOnline.class.php
+++ b/WhoIsOnline/WhoIsOnline.class.php
@@ -50,7 +50,6 @@
 
                // Hooks
                $this->setHook( 'ParserFirstCallInit' );
-               $this->setHook( 'BeforeInitialize' );
                $this->setHook( 'BeforePageDisplay');
                $this->setHook( 'LanguageGetMagic' );
                $this->setHook( 'BSWidgetBarGetDefaultWidgets' );
@@ -217,6 +216,19 @@
         * @return bool allow other hooked methods to be executed. Always true.
         */
        public function onParserFirstCallInit( &$oParser ) {
+               $oTitle = $oParser->getTitle() instanceof Title
+                       ? $oParser->getTitle()
+                       : RequestContext::getMain()->getTitle()
+               ;
+               if( !$oTitle instanceof Title ) {
+                       $oTitle = Title::newMainPage();
+               }
+               $this->insertTrace(
+                       $oTitle,
+                       RequestContext::getMain()->getUser(),
+                       RequestContext::getMain()->getRequest()
+               );
+
                $oParser->setFunctionHook( 'userscount', array( &$this, 
'onUsersCount' ) );
                $oParser->setHook( 'bs:whoisonline:count', array( &$this, 
'onUsersCountTag' ) );
                $oParser->setHook( 'bs:whoisonlinecount', array( &$this, 
'onUsersCountTag' ) );
@@ -236,25 +248,6 @@
        public function onLanguageGetMagic( &$aMagicWords, $sLangCode ) {
                $aMagicWords[ 'userscount' ] = array( 0, 'userscount' );
                $aMagicWords[ 'userslink' ]  = array( 0, 'userslink' );
-               return true;
-       }
-
-       /**
-        * Hook-Handler for MediaWiki hook BeforeInitialize - Inserts a trace 
of the user action into the database
-        * @param Title $oTitle
-        * @param Article $oArticle
-        * @param OutputPage $oOutput
-        * @param User $oUser
-        * @param WebRequest $oRequest
-        * @param MediaWiki $oMediaWiki
-        * @return boolean - alway true
-        */
-       public function onBeforeInitialize( &$oTitle, &$oArticle, &$oOutput, 
&$oUser, $oRequest, $oMediaWiki ) {
-               wfProfileIn( 'BS::'.__METHOD__ );
-
-               $this->insertTrace( $oTitle, $oUser, $oRequest );
-
-               wfProfileOut( 'BS::'.__METHOD__ );
                return true;
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I97c73e31c91983fb3b14c63eff05d3f324c9288f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_27
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to