Merge "Group E-mail settings stuff in Setup.php"
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 12 Sep 2014 22:37:05 +0000 (22:37 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 12 Sep 2014 22:37:05 +0000 (22:37 +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 );
  }
@@@ -302,7 -293,33 +302,33 @@@ if ( !$wgCookiePrefix ) 
  }
  $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
  
- $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
+ if ( $wgEnableEmail ) {
+       $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
+ } else {
+       // Disable all other email settings automatically if $wgEnableEmail
+       // is set to false. - bug 63678
+       $wgAllowHTMLEmail = false;
+       $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
+       $wgEnableUserEmail = false;
+       $wgEnotifFromEditor = false;
+       $wgEnotifImpersonal = false;
+       $wgEnotifMaxRecips = 0;
+       $wgEnotifMinorEdits = false;
+       $wgEnotifRevealEditorAddress = false;
+       $wgEnotifUseJobQ = false;
+       $wgEnotifUseRealName = false;
+       $wgEnotifUserTalk = false;
+       $wgEnotifWatchlist = false;
+       unset( $wgGroupPermissions['user']['sendemail'] );
+       $wgUseEnotif = false;
+       $wgUserEmailUseReplyTo = false;
+       $wgUsersNotifiedOnAllChanges = array();
+ }
+ // Doesn't make sense to have if disabled.
+ if ( !$wgEnotifMinorEdits ) {
+       $wgHiddenPrefs[] = 'enotifminoredits';
+ }
  
  if ( $wgMetaNamespace === false ) {
        $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
@@@ -355,11 -372,6 +381,6 @@@ if ( $wgUseFileCache || $wgUseSquid ) 
        $wgDebugToolbar = false;
  }
  
- // Doesn't make sense to have if disabled.
- if ( !$wgEnotifMinorEdits ) {
-       $wgHiddenPrefs[] = 'enotifminoredits';
- }
  // We always output HTML5 since 1.22, overriding these is no longer supported
  // we set them here for extensions that depend on its value.
  $wgHtml5 = true;
@@@ -405,14 -417,13 +426,14 @@@ if ( $wgCookieSecure === 'detect' ) 
        $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
  }
  
 -if ( $wgRC2UDPAddress ) {
 -      $wgRCFeeds['default'] = array(
 -              'formatter' => 'IRCColourfulRCFeedFormatter',
 -              'uri' => "udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
 -              'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
 -              'omit_bots' => &$wgRC2UDPOmitBots,
 -      );
 +// Back compatibility for $wgRateLimitLog deprecated with 1.23
 +if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
 +      $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
 +}
 +
 +if ( $wgProfileOnly ) {
 +      $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
 +      $wgDebugLogFile = '';
  }
  
  wfProfileOut( $fname . '-defaults' );
@@@ -479,6 -490,33 +500,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;
 -}
 -
 -if ( $wgProfileOnly ) {
 -      $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
 -      $wgDebugLogFile = '';
 -}
 -
  wfProfileOut( $fname . '-defaults2' );
  wfProfileIn( $fname . '-misc1' );
  
@@@ -541,15 -579,15 +562,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' );
@@@ -595,32 -633,8 +616,12 @@@ if ( !is_object( $wgAuth ) ) 
   */
  $wgTitle = null;
  
 +/**
 + * @deprecated since 1.24 Use DeferredUpdates::addUpdate instead
 + * @var array
 + */
  $wgDeferredUpdateList = array();
  
- // Disable all other email settings automatically if $wgEnableEmail
- // is set to false. - bug 63678
- if ( !$wgEnableEmail ) {
-       $wgAllowHTMLEmail = false;
-       $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
-       $wgEnableUserEmail = false;
-       $wgEnotifFromEditor = false;
-       $wgEnotifImpersonal = false;
-       $wgEnotifMaxRecips = 0;
-       $wgEnotifMinorEdits = false;
-       $wgEnotifRevealEditorAddress = false;
-       $wgEnotifUseJobQ = false;
-       $wgEnotifUseRealName = false;
-       $wgEnotifUserTalk = false;
-       $wgEnotifWatchlist = false;
-       unset( $wgGroupPermissions['user']['sendemail'] );
-       $wgUserEmailUseReplyTo = false;
-       $wgUsersNotifiedOnAllChanges = array();
- }
  wfProfileOut( $fname . '-globals' );
  wfProfileIn( $fname . '-extensions' );