Merge "rdbms: include client ID hash in ChronologyProtector cookies"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 4 Jun 2018 22:08:21 +0000 (22:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 4 Jun 2018 22:08:22 +0000 (22:08 +0000)
1  2 
includes/Setup.php

diff --combined includes/Setup.php
@@@ -533,7 -533,7 +533,7 @@@ if ( $wgInvalidateCacheOnLocalSettingsC
  }
  
  if ( $wgNewUserLog ) {
 -      // Add a new log type
 +      // Add new user log type
        $wgLogTypes[] = 'newusers';
        $wgLogNames['newusers'] = 'newuserlogpage';
        $wgLogHeaders['newusers'] = 'newuserlogpagetext';
        $wgLogActionsHandlers['newusers/autocreate'] = NewUsersLogFormatter::class;
  }
  
 +if ( $wgPageCreationLog ) {
 +      // Add page creation log type
 +      $wgLogTypes[] = 'create';
 +      $wgLogActionsHandlers['create/create'] = LogFormatter::class;
 +}
 +
  if ( $wgPageLanguageUseDB ) {
        $wgLogTypes[] = 'pagelang';
        $wgLogActionsHandlers['pagelang/pagelang'] = PageLangLogFormatter::class;
@@@ -736,20 -730,20 +736,20 @@@ if ( !$wgDBerrorLogTZ ) 
  // Initialize the request object in $wgRequest
  $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
  // Set user IP/agent information for agent session consistency purposes
+ $cpPosInfo = LBFactory::getCPInfoFromCookieValue(
+       // 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
+ );
  MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
        'IPAddress' => $wgRequest->getIP(),
        'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
        'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ),
-       '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
-               )
-       )
+       'ChronologyPositionIndex' => $wgRequest->getInt( 'cpPosIndex', $cpPosInfo['index'] ),
+       'ChronologyClientId' => $cpPosInfo['clientId']
  ] );
+ unset( $cpPosInfo );
  // 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