Merge "Don't set the session name in CLI or when sessions are deactivated"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 13 Aug 2014 22:30:55 +0000 (22:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 13 Aug 2014 22:30:55 +0000 (22:30 +0000)
1  2 
includes/Setup.php

diff --combined includes/Setup.php
@@@ -78,6 -78,14 +78,6 @@@ if ( $wgExtensionAssetsPath === false 
        $wgExtensionAssetsPath = "$wgScriptPath/extensions";
  }
  
 -// Enable default skins. Temporary, to be removed before 1.24 release.
 -// This is hacky and bad, the require_once calls should eventually be generated by the installer
 -// and placed in LocalSettings.php.
 -// While this is in Setup.php, it needs to be done as soon as possible, as some of the setup code
 -// depends on all extensions and skins being already required (bug 67318).
 -require_once "$wgStyleDirectory/MonoBook/MonoBook.php";
 -require_once "$wgStyleDirectory/Vector/Vector.php";
 -
  if ( $wgLogo === false ) {
        $wgLogo = "$wgStylePath/common/images/wiki.png";
  }
@@@ -263,23 -271,6 +263,23 @@@ if ( $wgSkipSkin ) 
        $wgSkipSkins[] = $wgSkipSkin;
  }
  
 +// Register skins
 +// Use a closure to avoid leaking into global state
 +call_user_func( function() use ( $wgValidSkinNames ) {
 +      $factory = SkinFactory::getDefaultInstance();
 +      foreach ( $wgValidSkinNames as $name => $skin ) {
 +              $factory->register( $name, $skin, function() use ( $name, $skin ) {
 +                      $class = "Skin$skin";
 +                      return new $class( $name );
 +              } );
 +      }
 +      // Register a hidden "fallback" skin
 +      $factory->register( 'fallback', 'Fallback', function() {
 +              return new SkinFallback;
 +      } );
 +} );
 +$wgSkipSkins[] = 'fallback';
 +
  if ( $wgLocalInterwiki ) {
        array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
  }
@@@ -478,6 -469,23 +478,6 @@@ if ( $wgTmpDirectory === false ) 
        wfProfileOut( $fname . '-tempDir' );
  }
  
 -// $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
 -// ensure back compatibility.
 -if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
 -      $wgHTCPRouting = $wgHTCPMulticastRouting;
 -}
 -
 -// Initialize $wgHTCPRouting from backwards-compatible settings that
 -// comes from pre 1.20 version.
 -if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
 -      $wgHTCPRouting = array(
 -              '' => array(
 -                      'host' => $wgHTCPMulticastAddress,
 -                      'port' => $wgHTCPPort,
 -              )
 -      );
 -}
 -
  // Back compatibility for $wgRateLimitLog deprecated with 1.23
  if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
        $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
@@@ -550,15 -558,15 +550,15 @@@ wfRunHooks( 'SetupAfterCache' )
  
  wfProfileIn( $fname . '-session' );
  
- // If session.auto_start is there, we can't touch session name
- if ( !wfIniGetBool( 'session.auto_start' ) ) {
-       session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
- }
+ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
+       // If session.auto_start is there, we can't touch session name
+       if ( !wfIniGetBool( 'session.auto_start' ) ) {
+               session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
+       }
  
- if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode &&
-       ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) )
- ) {
-       wfSetupSession();
+       if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
+               wfSetupSession();
+       }
  }
  
  wfProfileOut( $fname . '-session' );