* (bug 14646) Fix some double-escaping of HTML in feed output
[lhc/web/wiklou.git] / includes / Setup.php
index 4413741..61b3173 100644 (file)
@@ -10,7 +10,7 @@
 if( !defined( 'MEDIAWIKI' ) ) {
        echo "This file is part of MediaWiki, it is not a valid entry point.\n";
        exit( 1 );
-}      
+}
 
 # The main wiki script and things like database
 # conversion and maintenance scripts all share a
@@ -58,12 +58,11 @@ if ( empty( $wgFileStore['deleted']['directory'] ) ) {
        $wgFileStore['deleted']['directory'] = "{$wgUploadDirectory}/deleted";
 }
 
-
 /**
  * Initialise $wgLocalFileRepo from backwards-compatible settings
  */
 if ( !$wgLocalFileRepo ) {
-       $wgLocalFileRepo = array( 
+       $wgLocalFileRepo = array(
                'class' => 'LocalRepo',
                'name' => 'local',
                'directory' => $wgUploadDirectory,
@@ -101,7 +100,7 @@ if ( $wgUseSharedUploads ) {
                        'fetchDescription' => $wgFetchCommonsDescriptions,
                );
        } else {
-               $wgForeignFileRepos[] = array( 
+               $wgForeignFileRepos[] = array(
                        'class' => 'FSRepo',
                        'name' => 'shared',
                        'directory' => $wgSharedUploadDirectory,
@@ -115,7 +114,9 @@ if ( $wgUseSharedUploads ) {
        }
 }
 
-require_once( "$IP/includes/AutoLoader.php" );
+if ( !class_exists( 'AutoLoader' ) ) {
+       require_once( "$IP/includes/AutoLoader.php" );
+}
 
 wfProfileIn( $fname.'-exception' );
 require_once( "$IP/includes/Exception.php" );
@@ -159,6 +160,19 @@ if ( $wgCommandLineMode ) {
        wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" );
 }
 
+if( $wgRCFilterByAge ) {
+       ## Trim down $wgRCLinkDays so that it only lists links which are valid
+       ## as determined by $wgRCMaxAge.
+       ## Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
+       sort($wgRCLinkDays);
+       for( $i = 0; $i < count($wgRCLinkDays); $i++ ) {
+               if( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
+                       $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i+1, false );
+                       break;
+               }
+       }
+}
+
 if ( $wgSkipSkin ) {
        $wgSkipSkins[] = $wgSkipSkin;
 }
@@ -181,16 +195,21 @@ $messageMemc =& wfGetMessageCacheStorage();
 $parserMemc =& wfGetParserCacheStorage();
 
 wfDebug( 'Main cache: ' . get_class( $wgMemc ) .
-       "\nMessage cache: " . get_class( $messageMemc ) .
-          "\nParser cache: " . get_class( $parserMemc ) . "\n" );
+       "\nMessage cache: " . get_class( $messageMemc ) .
+       "\nParser cache: " . get_class( $parserMemc ) . "\n" );
 
 wfProfileOut( $fname.'-memcached' );
 wfProfileIn( $fname.'-SetupSession' );
 
-if ( $wgDBprefix ) {
-       $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
-} elseif ( $wgSharedDB ) {
+# Set default shared prefix
+if( $wgSharedPrefix === false ) $wgSharedPrefix = $wgDBprefix;
+
+if ( in_array('user', $wgSharedTables) && $wgSharedDB && $wgSharedPrefix ) {
+       $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
+} elseif ( in_array('user', $wgSharedTables) && $wgSharedDB ) {
        $wgCookiePrefix = $wgSharedDB;
+} elseif ( $wgDBprefix ) {
+       $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
 } else {
        $wgCookiePrefix = $wgDBname;
 }
@@ -223,8 +242,8 @@ $wgLang = new StubUserLang;
 $wgOut = new StubObject( 'wgOut', 'OutputPage' );
 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
 
-$wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache', 
-       array( $parserMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry, wfWikiID() ) );
+$wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache',
+       array( $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry, wfWikiID() ) );
 
 wfProfileOut( $fname.'-globals' );
 wfProfileIn( $fname.'-User' );
@@ -232,7 +251,7 @@ wfProfileIn( $fname.'-User' );
 # Skin setup functions
 # Entries can be added to this variable during the inclusion
 # of the extension file. Skins can then perform any necessary initialisation.
-# 
+#
 foreach ( $wgSkinExtensionFunctions as $func ) {
        call_user_func( $func );
 }
@@ -255,8 +274,6 @@ if ( $wgAjaxUploadDestCheck ) $wgAjaxExportList[] = 'UploadForm::ajaxGetExistsWa
 if( $wgAjaxLicensePreview )
        $wgAjaxExportList[] = 'UploadForm::ajaxGetLicensePreview';
 
-wfSeedRandom();
-
 # Placeholders in case of DB error
 $wgTitle = null;
 $wgArticle = null;
@@ -286,5 +303,3 @@ wfDebug( "Fully initialised\n" );
 $wgFullyInitialised = true;
 wfProfileOut( $fname.'-extensions' );
 wfProfileOut( $fname );
-
-