X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSetup.php;h=e1777b1ad76d004ec2a66b46c5af978d30ce4ea0;hb=cc54e1fa85762cf5b0f891ff0271b780eda28019;hp=35da714a486f0105535a14757e5bacda800fc4c0;hpb=2744ecb520e0f4e7ed140692c3bd0addf691bbc9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index 35da714a48..51368b1730 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -1,6 +1,10 @@ = $wgRCMaxAge / ( 3600 * 24 ) ) { $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false ); break; @@ -265,7 +268,11 @@ if ( $wgSkipSkin ) { $wgSkipSkins[] = $wgSkipSkin; } -# Set default shared prefix +if ( $wgLocalInterwiki ) { + array_unshift( $wgLocalInterwikis, $wgLocalInterwiki ); +} + +// Set default shared prefix if ( $wgSharedPrefix === false ) { $wgSharedPrefix = $wgDBprefix; } @@ -324,31 +331,31 @@ if ( is_array( $wgExtraNamespaces ) ) { $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces; } -# These are now the same, always -# To determine the user language, use $wgLang->getCode() +// These are now the same, always +// To determine the user language, use $wgLang->getCode() $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. +// 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; } -# Doesn't make sense to have if disabled. +// Doesn't make sense to have if disabled. if ( !$wgEnotifMinorEdits ) { $wgHiddenPrefs[] = 'enotifminoredits'; } -# We always output HTML5 since 1.22, overriding these is no longer supported -# we set them here for extensions that depend on its value. +// We always output HTML5 since 1.22, overriding these is no longer supported +// we set them here for extensions that depend on its value. $wgHtml5 = true; $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml'; $wgJsMimeType = 'text/javascript'; if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) { - # see http://www.w3.org/TR/rdfa-in-html/#document-conformance + // see http://www.w3.org/TR/rdfa-in-html/#document-conformance if ( $wgMimeType == 'application/xhtml+xml' ) { $wgHtml5Version = 'XHTML+RDFa 1.0'; } else { @@ -356,7 +363,7 @@ if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) { } } -# Blacklisted file extensions shouldn't appear on the "allowed" list +// Blacklisted file extensions shouldn't appear on the "allowed" list $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) ); if ( $wgArticleCountMethod === null ) { @@ -364,11 +371,13 @@ if ( $wgArticleCountMethod === null ) { } if ( $wgInvalidateCacheOnLocalSettingsChange ) { + // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet. $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) ); + // @codingStandardsIgnoreEnd } if ( $wgNewUserLog ) { - # Add a new log type + // Add a new log type $wgLogTypes[] = 'newusers'; $wgLogNames['newusers'] = 'newuserlogpage'; $wgLogHeaders['newusers'] = 'newuserlogpagetext'; @@ -392,7 +401,7 @@ if ( $wgRC2UDPAddress ) { ); } -wfProfileOut( $fname . '-defaults' ); +wfProfileOut( $fname . '-defaults' ); // Disable MWDebug for command line mode, this prevents MWDebug from eating up // all the memory from logging SQL queries on maintenance scripts @@ -418,23 +427,44 @@ require_once "$IP/includes/normal/UtfNormalDefines.php"; wfProfileOut( $fname . '-includes' ); wfProfileIn( $fname . '-defaults2' ); + +if ( $wgCanonicalServer === false ) { + $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP ); +} + +// Set server name +$serverParts = wfParseUrl( $wgCanonicalServer ); +if ( $wgServerName !== false ) { + wfWarn( '$wgServerName should be derived from $wgCanonicalServer, ' + . 'not customized. Overwriting $wgServerName.' ); +} +$wgServerName = $serverParts['host']; +unset( $serverParts ); + +// Set defaults for configuration variables +// that are derived from the server name by default +if ( $wgEmergencyContact === false ) { + $wgEmergencyContact = 'wikiadmin@' . $wgServerName; +} + +if ( $wgPasswordSender === false ) { + $wgPasswordSender = 'apache@' . $wgServerName; +} + if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) { $wgSecureLogin = false; - wfWarn( 'Secure login was enabled on a server that only supports HTTP or HTTPS. Disabling secure login.' ); + wfWarn( 'Secure login was enabled on a server that only supports ' + . 'HTTP or HTTPS. Disabling secure login.' ); } -# Now that GlobalFunctions is loaded, set defaults that depend -# on it. +// Now that GlobalFunctions is loaded, set defaults that depend +// on it. if ( $wgTmpDirectory === false ) { wfProfileIn( $fname . '-tempDir' ); $wgTmpDirectory = wfTempDir(); wfProfileOut( $fname . '-tempDir' ); } -if ( $wgCanonicalServer === false ) { - $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP ); -} - // $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22 // ensure back compatibility. if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) { @@ -452,10 +482,20 @@ if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) { ); } +// Back compatibility for $wgRateLimitLog deprecated with 1.23 +if ( $wgRateLimitLog && ! array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) { + $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog; +} + +if ( $wgProfileOnly ) { + $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile; + $wgDebugLogFile = ''; +} + wfProfileOut( $fname . '-defaults2' ); wfProfileIn( $fname . '-misc1' ); -# Raise the memory limit if it's too low +// Raise the memory limit if it's too low wfMemoryLimit(); /** @@ -474,13 +514,13 @@ if ( is_null( $wgLocalTZoffset ) ) { $wgLocalTZoffset = date( 'Z' ) / 60; } -# Useful debug output +// Useful debug output if ( $wgCommandLineMode ) { $wgRequest = new FauxRequest( array() ); wfDebug( "\n\nStart command line script $self\n" ); } else { - # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor + // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor $wgRequest = new WebRequest; $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n"; @@ -503,29 +543,26 @@ $messageMemc = wfGetMessageCacheStorage(); $parserMemc = wfGetParserCacheStorage(); $wgLangConvMemc = wfGetLangConverterCacheStorage(); -wfDebugLog( 'caches', get_class( $wgMemc ) . '[main] ' . - get_class( $messageMemc ) . '[message] ' . - get_class( $parserMemc ) . '[parser]' ); +wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) . + ', message: ' . get_class( $messageMemc ) . + ', parser: ' . get_class( $parserMemc ) ); wfProfileOut( $fname . '-memcached' ); -# # Most of the config is out, some might want to run hooks here. +// Most of the config is out, some might want to run hooks here. wfRunHooks( 'SetupAfterCache' ); wfProfileIn( $fname . '-session' ); -# If session.auto_start is there, we can't touch session name +// If session.auto_start is there, we can't touch session name if ( !wfIniGetBool( 'session.auto_start' ) ) { session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' ); } -if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) { - if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) { - wfSetupSession(); - $wgSessionStarted = true; - } else { - $wgSessionStarted = false; - } +if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode && + ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) +) { + wfSetupSession(); } wfProfileOut( $fname . '-session' ); @@ -537,7 +574,7 @@ $wgContLang->initContLang(); // Now that variant lists may be available... $wgRequest->interpolateTitle(); -$wgUser = RequestContext::getMain()->getUser(); # BackCompat +$wgUser = RequestContext::getMain()->getUser(); // BackCompat /** * @var $wgLang Language @@ -547,7 +584,7 @@ $wgLang = new StubUserLang; /** * @var OutputPage */ -$wgOut = RequestContext::getMain()->getOutput(); # BackCompat +$wgOut = RequestContext::getMain()->getOutput(); // BackCompat /** * @var $wgParser Parser @@ -564,15 +601,22 @@ $wgTitle = null; $wgDeferredUpdateList = array(); +// Enable default skins. +// This is hacky and bad, but it will go away before 1.24 release (or so I hope). +// These lines should eventually be placed in skins' meta definition files, and loaded by a +// require_once for each skin file generated by the installer and placed in LocalSettings.php. +$wgValidSkinNames['monobook'] = 'MonoBook'; +$wgValidSkinNames['vector'] = 'Vector'; + wfProfileOut( $fname . '-globals' ); wfProfileIn( $fname . '-extensions' ); -# 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 -# any necessary initialisation in the fully initialised environment +// 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 +// any necessary initialisation in the fully initialised environment foreach ( $wgExtensionFunctions as $func ) { - # Allow closures in PHP 5.3+ + // Allow closures in PHP 5.3+ if ( is_object( $func ) && $func instanceof Closure ) { $profName = $fname . '-extensions-closure'; } elseif ( is_array( $func ) ) {