Log multiple IPs using the same session or the same user account
[lhc/web/wiklou.git] / includes / Setup.php
index ba3d628..3ceb558 100644 (file)
@@ -796,16 +796,23 @@ foreach ( $wgExtensionFunctions as $func ) {
 
 // If the session user has a 0 id but a valid name, that means we need to
 // autocreate it.
-$sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
-if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
-       $ps_autocreate = Profiler::instance()->scopedProfileIn( $fname . '-autocreate' );
-       MediaWiki\Session\SessionManager::autoCreateUser( $sessionUser );
-       Profiler::instance()->scopedProfileOut( $ps_autocreate );
+if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
+       $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
+       if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
+               $ps_autocreate = Profiler::instance()->scopedProfileIn( $fname . '-autocreate' );
+               MediaWiki\Session\SessionManager::autoCreateUser( $sessionUser );
+               Profiler::instance()->scopedProfileOut( $ps_autocreate );
+       }
+       unset( $sessionUser );
 }
-unset( $sessionUser );
 
 wfDebug( "Fully initialised\n" );
 $wgFullyInitialised = true;
 
+// T125455
+if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
+       MediaWiki\Session\SessionManager::singleton()->checkIpLimits();
+}
+
 Profiler::instance()->scopedProfileOut( $ps_extensions );
 Profiler::instance()->scopedProfileOut( $ps_setup );