X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSetup.php;h=357c76d8d114bd01fd5585fcf47fcd029daaf543;hb=ba913218087b69a8e9bc4350bce6604fc53b683e;hp=cbe4e2e9d342485f623576d9f2523b540c0d2a46;hpb=abb4d29b54c1bc4b4fb620f1124559ead13a074e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index cbe4e2e9d3..357c76d8d1 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -505,6 +505,20 @@ if ( !class_exists( 'AutoLoader' ) ) { // re-created while taking into account any custom settings and extensions. MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' ); +if ( $wgSharedDB && $wgSharedTables ) { + // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections) + MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases( + array_fill_keys( + $wgSharedTables, + [ + 'dbname' => $wgSharedDB, + 'schema' => $wgSharedSchema, + 'prefix' => $wgSharedPrefix + ] + ) + ); +} + // Define a constant that indicates that the bootstrapping of the service locator // is complete. define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 ); @@ -638,6 +652,9 @@ date_default_timezone_set( $wgLocaltimezone ); if ( is_null( $wgLocalTZoffset ) ) { $wgLocalTZoffset = date( 'Z' ) / 60; } +// The part after the System| is ignored, but rest of MW fills it +// out as the local offset. +$wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset"; if ( !$wgDBerrorLogTZ ) { $wgDBerrorLogTZ = $wgLocaltimezone; @@ -645,6 +662,12 @@ if ( !$wgDBerrorLogTZ ) { // initialize the request object in $wgRequest $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat +// Set user IP/agent information for causal consistency purposes +MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [ + 'IPAddress' => $wgRequest->getIP(), + 'UserAgent' => $wgRequest->getHeader( 'User-Agent' ), + 'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ) +] ); // Useful debug output if ( $wgCommandLineMode ) { @@ -671,7 +694,7 @@ $parserMemc = wfGetParserCacheStorage(); wfDebugLog( 'caches', 'cluster: ' . get_class( $wgMemc ) . - ', WAN: ' . $wgMainWANCache . + ', WAN: ' . ( $wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache ) . ', stash: ' . $wgMainStash . ', message: ' . get_class( $messageMemc ) . ', parser: ' . get_class( $parserMemc ) . @@ -795,7 +818,9 @@ $wgOut = RequestContext::getMain()->getOutput(); // BackCompat /** * @var Parser $wgParser */ -$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], [ $wgParserConf ] ); +$wgParser = new StubObject( 'wgParser', function () { + return MediaWikiServices::getInstance()->getParser(); +} ); /** * @var Title $wgTitle