And while I'm at it: removed unused global declarations of $wgFeedClasses
[lhc/web/wiklou.git] / includes / Setup.php
index 88354c5..6f310c7 100644 (file)
@@ -8,7 +8,6 @@
  * MEDIAWIKI is defined
  */
 if( !defined( 'MEDIAWIKI' ) ) {
-       echo "This file is part of MediaWiki, it is not a valid entry point.\n";
        exit( 1 );
 }
 
@@ -41,6 +40,7 @@ if( $wgArticlePath === false ) {
 
 if( $wgStylePath === false ) $wgStylePath = "$wgScriptPath/skins";
 if( $wgStyleDirectory === false) $wgStyleDirectory   = "$IP/skins";
+if( $wgExtensionAssetsPath === false ) $wgExtensionAssetsPath = "$wgScriptPath/extensions";
 
 if( $wgLogo === false ) $wgLogo = "$wgStylePath/common/images/wiki.png";
 
@@ -87,7 +87,6 @@ if ( !$wgLocalFileRepo ) {
                'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
                'thumbScriptUrl' => $wgThumbnailScriptPath,
                'transformVia404' => !$wgGenerateThumbnailOnParse,
-               'initialCapital' => $wgCapitalLinks,
                'deletedDir' => $wgFileStore['deleted']['directory'],
                'deletedHashLevels' => $wgFileStore['deleted']['hash']
        );
@@ -130,6 +129,18 @@ 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,
+       );
+}
+
 if ( !class_exists( 'AutoLoader' ) ) {
        require_once( "$IP/includes/AutoLoader.php" );
 }
@@ -149,17 +160,18 @@ require_once( "$IP/includes/ImageFunctions.php" );
 require_once( "$IP/includes/StubObject.php" );
 wfProfileOut( $fname.'-includes' );
 wfProfileIn( $fname.'-misc1' );
+
 # Raise the memory limit if it's too low
-global $wgMemoryLimit;
-$memlimit = ini_get( "memory_limit" );
-if( !( empty( $memlimit ) || $memlimit == -1 ) ) {
-       if( wfParseMemoryLimit( $memlimit ) < wfParseMemoryLimit( $wgMemoryLimit ) ) {
-               wfDebug( "\n\nRaise PHP's memory limit from $memlimit to $wgMemoryLimit\n" );
-               wfDisableWarnings();
-               ini_set( "memory_limit", $wgMemoryLimit );
-               wfEnableWarnings();
-       }
-}
+wfMemoryLimit();
+
+/**
+ * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+ 
+ * that happens whenever you use a date function without the timezone being
+ * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
+ */
+wfSuppressWarnings();
+date_default_timezone_set( date_default_timezone_get() );
+wfRestoreWarnings();
 
 $wgIP = false; # Load on demand
 # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
@@ -177,7 +189,15 @@ if ( $wgCommandLineMode ) {
        }
        wfDebug( "\n" );
 } elseif( isset( $_SERVER['REQUEST_URI'] ) ) {
+       wfDebug( "\n\nStart request\n" );
        wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" );
+       foreach ( $_SERVER as $name => $value ) {
+               if ( substr( $name, 0, 5 ) == 'HTTP_' ) {
+                       $name = substr( $name, 5 );
+                       wfDebug( "$name: $value\n" );
+               }
+       }
+       wfDebug( "\n" );
 }
 
 if( $wgRCFilterByAge ) {
@@ -221,6 +241,13 @@ if( !$wgAllowUserSkin ) {
        $wgHiddenPrefs[] = 'skin';
 }
 
+if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
+       # see http://www.w3.org/TR/rdfa-in-html/#document-conformance
+       if ( $wgMimeType == 'application/xhtml+xml' ) $wgHtml5Version = 'XHTML+RDFa 1.0';
+       else $wgHtml5Version = 'HTML+RDFa 1.0';
+}
+
+
 wfProfileOut( $fname.'-misc1' );
 wfProfileIn( $fname.'-memcached' );
 
@@ -279,7 +306,6 @@ $wgRequest->interpolateTitle();
 
 $wgUser = new StubUser;
 $wgLang = new StubUserLang;
-$wgVariant = new StubUserVariant;
 $wgOut = new StubObject( 'wgOut', 'OutputPage' );
 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
 
@@ -310,9 +336,7 @@ $wgDeferredUpdateList = array();
 $wgPostCommitUpdateList = array();
 
 if ( $wgAjaxWatch ) $wgAjaxExportList[] = 'wfAjaxWatch';
-if ( $wgAjaxUploadDestCheck ) $wgAjaxExportList[] = 'UploadForm::ajaxGetExistsWarning';
-if( $wgAjaxLicensePreview )
-       $wgAjaxExportList[] = 'UploadForm::ajaxGetLicensePreview';
+if ( $wgAjaxUploadDestCheck ) $wgAjaxExportList[] = 'SpecialUpload::ajaxGetExistsWarning';
 
 # Placeholders in case of DB error
 $wgTitle = null;
@@ -321,16 +345,6 @@ $wgArticle = null;
 wfProfileOut( $fname.'-misc2' );
 wfProfileIn( $fname.'-extensions' );
 
-/*
- * load the $wgExtensionMessagesFiles for the script loader
- * this can't be done in a normal extension type way
- * since the script-loader is an entry point
- */
-if( $wgEnableScriptLoader && strpos( wfGetScriptUrl(), "mwScriptLoader.php" ) !== false ){
-       $wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php";
-}
-
-
 # Extension setup functions for extensions other than skins
 # Entries should be added to this variable during the inclusion
 # of the extension file. This allows the extension to perform