X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSetup.php;h=c9fe8d0fe812b389a0c9f7f8d7d619e00e417302;hb=18a2fd3268d1864d1480d5bfef0a69abf55a0dd4;hp=01f67c8caf74edbb6bc3ad95be032b1d39328d35;hpb=04f94a57ad6076684f186bb7242751607c842283;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index 01f67c8caf..c9fe8d0fe8 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -736,20 +736,22 @@ if ( !$wgDBerrorLogTZ ) { // Initialize the request object in $wgRequest $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat -// Set user IP/agent information for causal consistency purposes. -// The cpPosIndex cookie has no prefix and is set by MediaWiki::preOutputCommit(). -$cpPosIndex = $wgRequest->getInt( 'cpPosIndex', (int)$wgRequest->getCookie( 'cpPosIndex', '' ) ); +// Set user IP/agent information for agent session consistency purposes MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [ 'IPAddress' => $wgRequest->getIP(), 'UserAgent' => $wgRequest->getHeader( 'User-Agent' ), 'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ), - 'ChronologyPositionIndex' => $cpPosIndex + // The cpPosIndex cookie has no prefix and is set by MediaWiki::preOutputCommit() + 'ChronologyPositionIndex' => + $wgRequest->getInt( 'cpPosIndex', (int)$wgRequest->getCookie( 'cpPosIndex', '' ) ) ] ); -// Make sure that caching does not compromise the consistency improvements -if ( $cpPosIndex ) { +// Make sure that object caching does not undermine the ChronologyProtector improvements +if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) { + // The user is pinned to the primary DC, meaning that they made recent changes which should + // be reflected in their subsequent web requests. Avoid the use of interim cache keys because + // they use a blind TTL and could be stale if an object changes twice in a short time span. MediaWikiServices::getInstance()->getMainWANObjectCache()->useInterimHoldOffCaching( false ); } -unset( $cpPosIndex ); // Useful debug output if ( $wgCommandLineMode ) {