* Remove manual query building in search mysql
[lhc/web/wiklou.git] / includes / Setup.php
index e51efee..a264cb9 100644 (file)
@@ -51,8 +51,6 @@ if ( $wgLogo === false ) $wgLogo = "$wgStylePath/common/images/wiki.png";
 if ( $wgUploadPath === false ) $wgUploadPath = "$wgScriptPath/images";
 if ( $wgUploadDirectory === false ) $wgUploadDirectory = "$IP/images";
 
-if ( $wgMathPath === false ) $wgMathPath = "{$wgUploadPath}/math";
-if ( $wgMathDirectory === false ) $wgMathDirectory = "{$wgUploadDirectory}/math";
 if ( $wgTmpDirectory === false ) $wgTmpDirectory = "{$wgUploadDirectory}/tmp";
 
 if ( $wgReadOnlyFile === false ) $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
@@ -218,6 +216,35 @@ if ( $wgMetaNamespace === false ) {
        $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
 }
 
+/**
+ * Definitions of the NS_ constants are in Defines.php
+ * @private
+ */
+$wgCanonicalNamespaceNames = array(
+       NS_MEDIA            => 'Media',
+       NS_SPECIAL          => 'Special',
+       NS_TALK             => 'Talk',
+       NS_USER             => 'User',
+       NS_USER_TALK        => 'User_talk',
+       NS_PROJECT          => 'Project',
+       NS_PROJECT_TALK     => 'Project_talk',
+       NS_FILE             => 'File',
+       NS_FILE_TALK        => 'File_talk',
+       NS_MEDIAWIKI        => 'MediaWiki',
+       NS_MEDIAWIKI_TALK   => 'MediaWiki_talk',
+       NS_TEMPLATE         => 'Template',
+       NS_TEMPLATE_TALK    => 'Template_talk',
+       NS_HELP             => 'Help',
+       NS_HELP_TALK        => 'Help_talk',
+       NS_CATEGORY         => 'Category',
+       NS_CATEGORY_TALK    => 'Category_talk',
+);
+
+/// @todo UGLY UGLY
+if( is_array( $wgExtraNamespaces ) ) {
+       $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
+}
+
 # These are now the same, always
 # To determine the user language, use $wgLang->getCode()
 $wgContLanguageCode = $wgLanguageCode;
@@ -238,6 +265,19 @@ if ( !$wgAllowUserSkin ) {
        $wgHiddenPrefs[] = 'skin';
 }
 
+# Doesn't make sense to have if disabled.
+if ( !$wgEnotifMinorEdits ) {
+       $wgHiddenPrefs[] = 'enotifminoredits';
+}
+
+# $wgDisabledActions is deprecated as of 1.18
+foreach( $wgDisabledActions as $action ){
+       $wgActions[$action] = false;
+}
+if( !$wgAllowPageInfo ){
+       $wgActions['info'] = false;
+}
+
 if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
        # see http://www.w3.org/TR/rdfa-in-html/#document-conformance
        if ( $wgMimeType == 'application/xhtml+xml' ) {
@@ -269,23 +309,23 @@ if ( $wgNewUserLog ) {
        $wgLogActions['newusers/autocreate'] = 'newuserlog-autocreate-entry';
 }
 
-if ( !class_exists( 'AutoLoader' ) ) {
-       require_once( "$IP/includes/AutoLoader.php" );
-}
-
-wfProfileIn( $fname . '-exception' );
-require_once( "$IP/includes/Exception.php" );
-wfInstallExceptionHandler();
-wfProfileOut( $fname . '-exception' );
+if ( !defined( 'MW_COMPILED' ) ) {
+       if ( !MWInit::classExists( 'AutoLoader' ) ) {
+               require_once( "$IP/includes/AutoLoader.php" );
+       }
 
-wfProfileIn( $fname . '-includes' );
-require_once( "$IP/includes/GlobalFunctions.php" );
-require_once( "$IP/includes/Hooks.php" );
-require_once( "$IP/includes/Namespace.php" );
-require_once( "$IP/includes/ProxyTools.php" );
-require_once( "$IP/includes/ObjectCache.php" );
-require_once( "$IP/includes/ImageFunctions.php" );
-wfProfileOut( $fname . '-includes' );
+       wfProfileIn( $fname . '-exception' );
+       require_once( "$IP/includes/Exception.php" );
+       wfInstallExceptionHandler();
+       wfProfileOut( $fname . '-exception' );
+
+       wfProfileIn( $fname . '-includes' );
+       require_once( "$IP/includes/GlobalFunctions.php" );
+       require_once( "$IP/includes/Hooks.php" );
+       require_once( "$IP/includes/ProxyTools.php" );
+       require_once( "$IP/includes/ImageFunctions.php" );
+       wfProfileOut( $fname . '-includes' );
+}
 wfProfileIn( $fname . '-misc1' );
 
 # Raise the memory limit if it's too low
@@ -308,45 +348,24 @@ global $wgCommandLineMode;
 if ( $wgCommandLineMode ) {
        wfDebug( "\n\nStart command line script $self\n" );
 } else {
-       wfDebug( "Start request\n\n" );
-       # Output the REQUEST_URI. This is not supported by IIS in rewrite mode,
-       # so use an alternative
-       if ( isset( $_SERVER['REQUEST_URI'] ) ) {
-               $requestUri = $_SERVER['REQUEST_URI'];
-       } elseif ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
-               $requestUri = $_SERVER['HTTP_X_ORIGINAL_URL'];
-       } else {
-               $requestUri = $_SERVER['PHP_SELF'];
-       }
-
-       wfDebug( "{$_SERVER['REQUEST_METHOD']} {$requestUri}\n" );
+       $debug = "Start request\n\n{$_SERVER['REQUEST_METHOD']} {$wgRequest->getRequestURL()}";
 
        if ( $wgDebugPrintHttpHeaders ) {
-               $headerOut = "HTTP HEADERS:\n";
-
-               if ( function_exists( 'getallheaders' ) ) {
-                       $headers = getallheaders();
-                       foreach ( $headers as $name => $value ) {
-                               $headerOut .= "$name: $value\n";
-                       }
-               } else {
-                       $headers = $_SERVER;
-                       foreach ( $headers as $name => $value ) {
-                               if ( substr( $name, 0, 5 ) !== 'HTTP_' ) continue;
-                               $name = substr( $name, 5 );
-                               $headerOut .= "$name: $value\n";
-                       }
+               $debug .= "\nHTTP HEADERS:\n";
+
+               foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
+                       $debug .= "$name: $value\n";
                }
-               wfDebug( "$headerOut\n" );
        }
+       wfDebug( "$debug\n" );
 }
 
 wfProfileOut( $fname . '-misc1' );
 wfProfileIn( $fname . '-memcached' );
 
-$wgMemc =& wfGetMainCache();
-$messageMemc =& wfGetMessageCacheStorage();
-$parserMemc =& wfGetParserCacheStorage();
+$wgMemc = wfGetMainCache();
+$messageMemc = wfGetMessageCacheStorage();
+$parserMemc = wfGetParserCacheStorage();
 
 wfDebug( 'CACHES: ' . get_class( $wgMemc ) . '[main] ' .
        get_class( $messageMemc ) . '[message] ' .
@@ -382,13 +401,22 @@ $wgContLang = new StubContLang;
 
 // Now that variant lists may be available...
 $wgRequest->interpolateTitle();
-$wgUser = $wgCommandLineMode ? new User : User::newFromSession();
+$wgUser = RequestContext::getMain()->user; # BackCompat
+
+/**
+ * @var Language
+ */
 $wgLang = new StubUserLang;
-$wgOut = new StubObject( 'wgOut', 'OutputPage' );
-$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
 
-$wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache',
-       array( $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry ) );
+/**
+ * @var OutputPage
+ */
+$wgOut = RequestContext::getMain()->output; # BackCompat
+
+/**
+ * @var Parser
+ */
+$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
 
 if ( !is_object( $wgAuth ) ) {
        $wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' );
@@ -442,4 +470,7 @@ wfRunHooks( 'LogPageActionText', array( &$wgLogActions ) );
 wfDebug( "Fully initialised\n" );
 $wgFullyInitialised = true;
 wfProfileOut( $fname . '-extensions' );
+
+require_once( MWInit::compiledPath( 'includes/normal/UtfNormalDefines.php' ) );
+
 wfProfileOut( $fname );