Aaron Schulz has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/393983 )
Change subject: Make ChronologyProtector actually use cpPosTime cookies
......................................................................
Make ChronologyProtector actually use cpPosTime cookies
Setup.php was only injected the value from $_GET.
Also refactor LBFactory handling of the cpPosTime URL parameter.
Change-Id: Ie5744577609f4c193cacd71334f92b30f02e3846
---
M includes/Setup.php
M includes/libs/rdbms/lbfactory/ILBFactory.php
M includes/libs/rdbms/lbfactory/LBFactory.php
3 files changed, 7 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/83/393983/1
diff --git a/includes/Setup.php b/includes/Setup.php
index 4c281b1..1dc6ee8 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -740,7 +740,9 @@
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
'IPAddress' => $wgRequest->getIP(),
'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
- 'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection'
)
+ 'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection'
),
+ 'ChronologyPositionTime' => $wgRequest->getCookie( 'cpPosTime', '' )
+ ?: $wgRequest->getVal( 'cpPosTime' )
] );
// Useful debug output
diff --git a/includes/libs/rdbms/lbfactory/ILBFactory.php
b/includes/libs/rdbms/lbfactory/ILBFactory.php
index f6d080e..697af0e 100644
--- a/includes/libs/rdbms/lbfactory/ILBFactory.php
+++ b/includes/libs/rdbms/lbfactory/ILBFactory.php
@@ -319,6 +319,7 @@
* - IPAddress : IP address
* - UserAgent : User-Agent HTTP header
* - ChronologyProtection : cookie/header value specifying
ChronologyProtector usage
+ * - ChronologyPositionTime: timestamp used to get up-to-date DB
positions for the agent
*/
public function setRequestInfo( array $info );
}
diff --git a/includes/libs/rdbms/lbfactory/LBFactory.php
b/includes/libs/rdbms/lbfactory/LBFactory.php
index c891fb6..ef716b6 100644
--- a/includes/libs/rdbms/lbfactory/LBFactory.php
+++ b/includes/libs/rdbms/lbfactory/LBFactory.php
@@ -115,7 +115,8 @@
$this->requestInfo = [
'IPAddress' => isset( $_SERVER[ 'REMOTE_ADDR' ] ) ?
$_SERVER[ 'REMOTE_ADDR' ] : '',
'UserAgent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ?
$_SERVER['HTTP_USER_AGENT'] : '',
- 'ChronologyProtection' => 'true'
+ 'ChronologyProtection' => 'true',
+ 'ChronologyPositionTime' => isset( $_GET['cpPosTime'] )
? $_GET['cpPosTime'] : null
];
$this->cliMode = isset( $conf['cliMode'] ) ? $conf['cliMode'] :
PHP_SAPI === 'cli';
@@ -440,7 +441,7 @@
'ip' => $this->requestInfo['IPAddress'],
'agent' => $this->requestInfo['UserAgent'],
],
- isset( $_GET['cpPosTime'] ) ? $_GET['cpPosTime'] : null
+ $this->requestInfo['ChronologyPositionTime']
);
$this->chronProt->setLogger( $this->replLogger );
--
To view, visit https://gerrit.wikimedia.org/r/393983
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5744577609f4c193cacd71334f92b30f02e3846
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits