Merge "Remove no-op parameter from UIDGeneratorTest"
[lhc/web/wiklou.git] / includes / Setup.php
index 4854727..189855e 100644 (file)
@@ -517,6 +517,11 @@ if ( $wgPHPSessionHandling !== 'enable' &&
 ) {
        $wgPHPSessionHandling = 'warn';
 }
+if ( defined( 'MW_NO_SESSION' ) ) {
+       // If the entry point wants no session, force 'disable' here unless they
+       // specifically set it to the (undocumented) 'warn'.
+       $wgPHPSessionHandling = MW_NO_SESSION === 'warn' ? 'warn' : 'disable';
+}
 
 Profiler::instance()->scopedProfileOut( $ps_default );
 
@@ -702,10 +707,13 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
                session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
        }
 
-       // Create the SessionManager singleton and set up our session handler
-       MediaWiki\Session\PHPSessionHandler::install(
-               MediaWiki\Session\SessionManager::singleton()
-       );
+       // Create the SessionManager singleton and set up our session handler,
+       // unless we're specifically asked not to.
+       if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
+               MediaWiki\Session\PHPSessionHandler::install(
+                       MediaWiki\Session\SessionManager::singleton()
+               );
+       }
 
        // Initialize the session
        try {
@@ -740,6 +748,16 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
                session_id( $session->getId() );
                MediaWiki\quietCall( 'session_start' );
        }
+
+       unset( $session );
+} else {
+       // Even if we didn't set up a global Session, still install our session
+       // handler unless specifically requested not to.
+       if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
+               MediaWiki\Session\PHPSessionHandler::install(
+                       MediaWiki\Session\SessionManager::singleton()
+               );
+       }
 }
 Profiler::instance()->scopedProfileOut( $ps_session );
 
@@ -809,10 +827,5 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
 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 );