X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSetup.php;h=a1bca22b72116d8ff576d063ae8bde6cac642978;hb=5dc4dc099d8799cf98dcda9016f77903d5868eb4;hp=e1777b1ad76d004ec2a66b46c5af978d30ce4ea0;hpb=42db755b218345715da80d40ee53bd3a4e4d9820;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index e1777b1ad7..a1bca22b72 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; @@ -269,7 +272,7 @@ if ( $wgLocalInterwiki ) { array_unshift( $wgLocalInterwikis, $wgLocalInterwiki ); } -# Set default shared prefix +// Set default shared prefix if ( $wgSharedPrefix === false ) { $wgSharedPrefix = $wgDBprefix; } @@ -328,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 { @@ -360,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 ) { @@ -368,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'; @@ -422,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 ) { @@ -469,7 +495,7 @@ if ( $wgProfileOnly ) { 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(); /** @@ -488,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"; @@ -517,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' ); @@ -551,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 @@ -561,7 +584,7 @@ $wgLang = new StubUserLang; /** * @var OutputPage */ -$wgOut = RequestContext::getMain()->getOutput(); # BackCompat +$wgOut = RequestContext::getMain()->getOutput(); // BackCompat /** * @var $wgParser Parser @@ -581,12 +604,12 @@ $wgDeferredUpdateList = array(); 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 ) ) {