X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FSetup.php;h=f367fc2278cf61c77a3310613110ea98a0dccff4;hb=87e11b9bf5fd9d73c65140d3fa8240dac71201a0;hp=bcdc1d57a200784d8f3a48c9d2eb86de5ab248d1;hpb=b8e0ca16aa743581f5fac5cef8bed5ac2bf6e7cb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index bcdc1d57a2..f367fc2278 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -518,9 +518,61 @@ foreach ( LanguageCode::getNonstandardLanguageCodeMapping() as $code => $bcp47 ) // To determine the user language, use $wgLang->getCode() $wgContLanguageCode = $wgLanguageCode; +// Temporary backwards-compatibility reading of old Squid-named CDN settings as of MediaWiki 1.34, +// to support sysadmins who fail to update their settings immediately: + +if ( isset( $wgUseSquid ) ) { + // If the sysadmin is still setting a value of $wgUseSquid to true but $wgUseCdn is the default of + // false, to be safe, assume they do want this still, so enable it. + if ( !$wgUseCdn && $wgUseSquid ) { + $wgUseCdn = $wgUseSquid; + wfDeprecated( '$wgUseSquid enabled but $wgUseCdn disabled; enabling CDN functions', '1.34' ); + } +} else { + // Backwards-compatibility for extensions that read this value. + $wgUseSquid = $wgUseCdn; +} + +if ( isset( $wgSquidServers ) ) { + // If the sysadmin is still setting a value of $wgSquidServers but $wgCdnServers is the default of + // empty, to be safe, assume they do want these servers to be still used, so use them. + if ( !empty( $wgSquidServers ) && empty( $wgCdnServers ) ) { + $wgCdnServers = $wgSquidServers; + wfDeprecated( '$wgSquidServers set, $wgCdnServers empty; using them', '1.34' ); + } +} else { + // Backwards-compatibility for extensions that read this value. + $wgSquidServers = $wgCdnServers; +} + +if ( isset( $wgSquidServersNoPurge ) ) { + // If the sysadmin is still setting values in $wgSquidServersNoPurge but $wgCdnServersNoPurge is + // the default of empty, to be safe, assume they do want these servers to be still used, so use + // them. + if ( !empty( $wgSquidServersNoPurge ) && empty( $wgCdnServersNoPurge ) ) { + $wgCdnServersNoPurge = $wgSquidServersNoPurge; + wfDeprecated( '$wgSquidServersNoPurge set, $wgCdnServersNoPurge empty; using them', '1.34' ); + } +} else { + // Backwards-compatibility for extensions that read this value. + $wgSquidServersNoPurge = $wgCdnServersNoPurge; +} + +if ( isset( $wgSquidMaxage ) ) { + // If the sysadmin is still setting a value of $wgSquidMaxage and it's higher than $wgCdnMaxAge, + // to be safe, assume they want the higher (lower performance requirement) value, so use that. + if ( $wgCdnMaxAge < $wgSquidMaxage ) { + $wgCdnMaxAge = $wgSquidMaxage; + wfDeprecated( '$wgSquidMaxage set higher than $wgCdnMaxAge; using the higher value', '1.34' ); + } +} else { + // Backwards-compatibility for extensions that read this value. + $wgSquidMaxage = $wgCdnMaxAge; +} + // Easy to forget to falsify $wgDebugToolbar for static caches. // If file cache or CDN cache is on, just disable this (DWIMD). -if ( $wgUseFileCache || $wgUseSquid ) { +if ( $wgUseFileCache || $wgUseCdn ) { $wgDebugToolbar = false; } @@ -605,20 +657,6 @@ if ( $wgDebugToolbar && !$wgCommandLineMode ) { // 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 ); @@ -694,6 +732,20 @@ if ( $wgMainWANCache === false ) { ]; } +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 + ] + ) + ); +} + Profiler::instance()->scopedProfileOut( $ps_default2 ); $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc' ); @@ -736,9 +788,10 @@ $cpPosInfo = LBFactory::getCPInfoFromCookieValue( MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [ 'IPAddress' => $wgRequest->getIP(), 'UserAgent' => $wgRequest->getHeader( 'User-Agent' ), - 'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ), + 'ChronologyProtection' => $wgRequest->getHeader( 'MediaWiki-Chronology-Protection' ), 'ChronologyPositionIndex' => $wgRequest->getInt( 'cpPosIndex', $cpPosInfo['index'] ), 'ChronologyClientId' => $cpPosInfo['clientId'] + ?? $wgRequest->getHeader( 'MediaWiki-Chronology-Client-Id' ) ] ); unset( $cpPosInfo ); // Make sure that object caching does not undermine the ChronologyProtector improvements