diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2008-08-15 01:29:47 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2008-08-15 01:29:47 +0200 |
commit | 370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch) | |
tree | 491674f4c242e4d6ba0d04eafa305174c35a3391 /includes/Setup.php | |
parent | f4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff) |
Update auf 1.13.0
Diffstat (limited to 'includes/Setup.php')
-rw-r--r-- | includes/Setup.php | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/includes/Setup.php b/includes/Setup.php index 53e0b949..877ea766 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -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,16 @@ if ( $wgUseSharedUploads ) { } } -require_once( "$IP/includes/AutoLoader.php" ); +/** + * Workaround for http://bugs.php.net/bug.php?id=45132 + * escapeshellarg() destroys non-ASCII characters if LANG is not a UTF-8 locale + */ +putenv( 'LC_CTYPE=en_US.UTF-8' ); +setlocale( LC_CTYPE, 'en_US.UTF-8' ); + +if ( !class_exists( 'AutoLoader' ) ) { + require_once( "$IP/includes/AutoLoader.php" ); +} wfProfileIn( $fname.'-exception' ); require_once( "$IP/includes/Exception.php" ); @@ -159,6 +167,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,18 +202,25 @@ $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 ) { - $wgCookiePrefix = $wgSharedDB; -} else { - $wgCookiePrefix = $wgDBname; +# Set default shared prefix +if( $wgSharedPrefix === false ) $wgSharedPrefix = $wgDBprefix; + +if( !$wgCookiePrefix ) { + 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; + } } $wgCookiePrefix = strtr($wgCookiePrefix, "=,; +.\"'\\[", "__________"); @@ -213,20 +241,6 @@ if( !$wgCommandLineMode && ( $wgRequest->checkSessionCookie() || isset( $_COOKIE wfProfileOut( $fname.'-SetupSession' ); wfProfileIn( $fname.'-globals' ); -if ( !$wgDBservers ) { - $wgDBservers = array(array( - 'host' => $wgDBserver, - 'user' => $wgDBuser, - 'password' => $wgDBpassword, - 'dbname' => $wgDBname, - 'type' => $wgDBtype, - 'load' => 1, - 'flags' => ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT - )); -} - -$wgLoadBalancer = new StubObject( 'wgLoadBalancer', 'LoadBalancer', - array( $wgDBservers, false, $wgMasterWaitTimeout, true ) ); $wgContLang = new StubContLang; // Now that variant lists may be available... @@ -237,8 +251,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' ); @@ -246,7 +260,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 ); } @@ -269,8 +283,6 @@ if ( $wgAjaxUploadDestCheck ) $wgAjaxExportList[] = 'UploadForm::ajaxGetExistsWa if( $wgAjaxLicensePreview ) $wgAjaxExportList[] = 'UploadForm::ajaxGetLicensePreview'; -wfSeedRandom(); - # Placeholders in case of DB error $wgTitle = null; $wgArticle = null; @@ -300,5 +312,3 @@ wfDebug( "Fully initialised\n" ); $wgFullyInitialised = true; wfProfileOut( $fname.'-extensions' ); wfProfileOut( $fname ); - - |