Merge "Log autocreation attempts in SessionManager"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 23 May 2016 17:53:38 +0000 (17:53 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 23 May 2016 17:53:38 +0000 (17:53 +0000)
1  2 
includes/Setup.php

diff --combined includes/Setup.php
@@@ -517,7 -517,7 +517,7 @@@ if ( !class_exists( 'AutoLoader' ) ) 
  
  // Reset the global service locator, so any services that have already been created will be
  // re-created while taking into account any custom settings and extensions.
 -MediaWikiServices::resetGlobalInstance( new GlobalVarConfig() );
 +MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
  
  // Define a constant that indicates that the bootstrapping of the service locator
  // is complete.
@@@ -850,15 -850,20 +850,20 @@@ if ( !defined( 'MW_NO_SESSION' ) && !$w
        if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
                $ps_autocreate = Profiler::instance()->scopedProfileIn( $fname . '-autocreate' );
                if ( $wgDisableAuthManager ) {
-                       MediaWiki\Session\SessionManager::autoCreateUser( $sessionUser );
+                       $res = MediaWiki\Session\SessionManager::autoCreateUser( $sessionUser );
                } else {
-                       MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
+                       $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
                                $sessionUser,
-                               MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSSION,
+                               MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
                                true
                        );
                }
                Profiler::instance()->scopedProfileOut( $ps_autocreate );
+               \MediaWiki\Logger\LoggerFactory::getInstance( 'authmanager' )->info( 'Autocreation attempt', [
+                       'event' => 'autocreate',
+                       'status' => $res,
+               ] );
+               unset( $res );
        }
        unset( $sessionUser );
  }