Gergő Tisza has uploaded a new change for review.

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

Change subject: Don't try to auto-create users when MW_NO_SESSION is defined
......................................................................

Don't try to auto-create users when MW_NO_SESSION is defined

Bug: T126177
Change-Id: Ia62ec77cd2cc177d81923a96171498dbc8c0ed50
(cherry-picked from 2dc62613a11dfff7c2793987c28ca72408757db1)
---
M includes/Setup.php
1 file changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/272815/1

diff --git a/includes/Setup.php b/includes/Setup.php
index 8009c2d..3ceb558 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -796,13 +796,15 @@
 
 // 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;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia62ec77cd2cc177d81923a96171498dbc8c0ed50
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.13
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>

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

Reply via email to