Merge "OutputPage: Remove appending of wgStyleVersion to legacy resources"
[lhc/web/wiklou.git] / includes / Setup.php
index 5cc9a96..2c315a3 100644 (file)
@@ -24,6 +24,8 @@
  * @file
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\LBFactory;
+use Wikimedia\Rdbms\ChronologyProtector;
 
 /**
  * This file is not a valid entry point, perform no further processing unless
@@ -738,9 +740,15 @@ MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
        'IPAddress' => $wgRequest->getIP(),
        'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
        'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ),
-       // The cpPosIndex cookie has no prefix and is set by MediaWiki::preOutputCommit()
-       'ChronologyPositionIndex' =>
-               $wgRequest->getInt( 'cpPosIndex', (int)$wgRequest->getCookie( 'cpPosIndex', '' ) )
+       'ChronologyPositionIndex' => $wgRequest->getInt(
+               'cpPosIndex',
+               LBFactory::getCPIndexFromCookieValue(
+                       // The cookie has no prefix and is set by MediaWiki::preOutputCommit()
+                       $wgRequest->getCookie( 'cpPosIndex', '' ),
+                       // Mitigate broken client-side cookie expiration handling (T190082)
+                       time() - ChronologyProtector::POSITION_COOKIE_TTL
+               )
+       )
 ] );
 // Make sure that object caching does not undermine the ChronologyProtector improvements
 if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) {