Reverted r113177 per CR
[lhc/web/wiklou.git] / includes / Setup.php
index 4682994..d0ce209 100644 (file)
@@ -114,6 +114,19 @@ $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
 $wgNamespaceAliases['Image'] = NS_FILE;
 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
 
+/**
+ * Initialise $wgLockManagers to include basic FS version
+ */
+$wgLockManagers[] = array(
+       'name'          => 'fsLockManager',
+       'class'         => 'FSLockManager',
+       'lockDirectory' => "{$wgUploadDirectory}/lockdir",
+);
+$wgLockManagers[] = array(
+       'name'          => 'nullLockManager',
+       'class'         => 'NullLockManager',
+);
+
 /**
  * Initialise $wgLocalFileRepo from backwards-compatible settings
  */
@@ -163,7 +176,7 @@ if ( $wgUseSharedUploads ) {
                );
        } else {
                $wgForeignFileRepos[] = array(
-                       'class' => 'FSRepo',
+                       'class' => 'FileRepo',
                        'name' => 'shared',
                        'directory' => $wgSharedUploadDirectory,
                        'url' => $wgSharedUploadPath,
@@ -177,15 +190,38 @@ if ( $wgUseSharedUploads ) {
 }
 if ( $wgUseInstantCommons ) {
        $wgForeignFileRepos[] = array(
-               'class'                   => 'ForeignAPIRepo',
-               'name'                    => 'wikimediacommons',
-               'apibase'                 => 'http://commons.wikimedia.org/w/api.php',
-               'hashLevels'              => 2,
-               'fetchDescription'        => true,
-               'descriptionCacheExpiry'  => 43200,
-               'apiThumbCacheExpiry'     => 86400,
+               'class'                  => 'ForeignAPIRepo',
+               'name'                   => 'wikimediacommons',
+               'apibase'                => WebRequest::detectProtocol() === 'https' ?
+                       'https://commons.wikimedia.org/w/api.php' :
+                       'http://commons.wikimedia.org/w/api.php',
+               'hashLevels'             => 2,
+               'fetchDescription'       => true,
+               'descriptionCacheExpiry' => 43200,
+               'apiThumbCacheExpiry'    => 86400,
        );
 }
+/*
+ * Add on default file backend config for file repos.
+ * FileBackendGroup will handle initializing the backends.
+ */
+if ( !isset( $wgLocalFileRepo['backend'] ) ) {
+       $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
+}
+foreach ( $wgForeignFileRepos as &$repo ) {
+       if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
+               $repo['directory'] = $wgUploadDirectory; // b/c
+       }
+       if ( !isset( $repo['backend'] ) ) {
+               $repo['backend'] = $repo['name'] . '-backend';
+       }
+}
+unset( $repo ); // no global pollution; destroy reference
+
+if ( is_null( $wgEnableAutoRotation ) ) {
+       // Only enable auto-rotation when the bitmap handler can rotate
+       $wgEnableAutoRotation = BitmapHandler::canRotate();
+}
 
 if ( $wgRCFilterByAge ) {
        # # Trim down $wgRCLinkDays so that it only lists links which are valid
@@ -263,8 +299,10 @@ $wgContLanguageCode = $wgLanguageCode;
 
 # Easy to forget to falsify $wgShowIPinHeader for static caches.
 # If file cache or squid cache is on, just disable this (DWIMD).
+# Do the same for $wgDebugToolbar.
 if ( $wgUseFileCache || $wgUseSquid ) {
        $wgShowIPinHeader = false;
+       $wgDebugToolbar = false;
 }
 
 # $wgAllowRealName and $wgAllowUserSkin were removed in 1.16
@@ -323,6 +361,13 @@ if ( $wgCookieSecure === 'detect' ) {
        $wgCookieSecure = ( substr( $wgServer, 0, 6 ) === 'https:' );
 }
 
+// Disable MWDebug for command line mode, this prevents MWDebug from eating up
+// all the memory from logging SQL queries on maintenance scripts
+global $wgCommandLineMode;
+if ( $wgDebugToolbar && !$wgCommandLineMode ) {
+       MWDebug::init();
+}
+
 if ( !defined( 'MW_COMPILED' ) ) {
        if ( !MWInit::classExists( 'AutoLoader' ) ) {
                require_once( "$IP/includes/AutoLoader.php" );
@@ -368,7 +413,6 @@ if( is_null( $wgLocalTZoffset ) ) {
 }
 
 # Useful debug output
-global $wgCommandLineMode;
 if ( $wgCommandLineMode ) {
        $wgRequest = new FauxRequest( array() );
 
@@ -377,16 +421,16 @@ if ( $wgCommandLineMode ) {
        # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
        $wgRequest = new WebRequest;
 
-       $debug = "Start request\n\n{$_SERVER['REQUEST_METHOD']} {$wgRequest->getRequestURL()}";
+       $debug = "\n\nStart request\n{$_SERVER['REQUEST_METHOD']} {$wgRequest->getRequestURL()}\n";
 
        if ( $wgDebugPrintHttpHeaders ) {
-               $debug .= "\nHTTP HEADERS:\n";
+               $debug .= "HTTP HEADERS:\n";
 
                foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
                        $debug .= "$name: $value\n";
                }
        }
-       wfDebug( "$debug\n" );
+       wfDebug( $debug );
 }
 
 wfProfileOut( $fname . '-misc1' );
@@ -435,7 +479,7 @@ $wgRequest->interpolateTitle();
 $wgUser = RequestContext::getMain()->getUser(); # BackCompat
 
 /**
- * @var Language
+ * @var $wgLang Language
  */
 $wgLang = new StubUserLang;
 
@@ -445,7 +489,7 @@ $wgLang = new StubUserLang;
 $wgOut = RequestContext::getMain()->getOutput(); # BackCompat
 
 /**
- * @var Parser
+ * @var $wgParser Parser
  */
 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
 
@@ -459,12 +503,6 @@ $wgTitle = null;
 
 $wgDeferredUpdateList = array();
 
-// We need to check for safe_mode, because mail() will throw an E_NOTICE
-// on additional parameters
-if( !is_null($wgAdditionalMailParams) && wfIniGetBool('safe_mode') ) {
-       $wgAdditionalMailParams = null;
-}
-
 wfProfileOut( $fname . '-globals' );
 wfProfileIn( $fname . '-extensions' );