Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/352632 )
Change subject: ApiQueryRevisions: Restore use of rvstartid/rvendid as a tiebreaker ...................................................................... ApiQueryRevisions: Restore use of rvstartid/rvendid as a tiebreaker If rvstartid/rvendid are used with revisions that have the same timestamp, we should omit any revisions with the same timestamp but out-of-range IDs. Bug: T163532 Change-Id: I6ba5e0724945668dad55eec0d09cb7d3fe08e347 --- M includes/api/ApiQueryRevisions.php 1 file changed, 26 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/32/352632/1 diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 3e077c3..b0a8468 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -259,12 +259,34 @@ $p = $this->encodeParamName( 'endid' ); $this->dieWithError( [ 'apierror-revisions-badid', $p ], "badid_$p" ); } + + if ( $params['start'] !== null ) { + $op = ( $params['dir'] === 'newer' ? '>' : '<' ); + $ts = $db->addQuotes( $db->timestampOrNull( $params['start'] ) ); + if ( $params['startid'] !== null ) { + $this->addWhere( "rev_timestamp $op $ts OR " + . "rev_timestamp = $ts AND rev_id $op= " . intval( $params['startid'] ) ); + } else { + $this->addWhere( "rev_timestamp $op= $ts" ); + } + } + if ( $params['end'] !== null ) { + $op = ( $params['dir'] === 'newer' ? '<' : '>' ); // Yes, opposite of the above + $ts = $db->addQuotes( $db->timestampOrNull( $params['end'] ) ); + if ( $params['endid'] !== null ) { + $this->addWhere( "rev_timestamp $op $ts OR " + . "rev_timestamp = $ts AND rev_id $op= " . intval( $params['endid'] ) ); + } else { + $this->addWhere( "rev_timestamp $op= $ts" ); + } + } + } else { + $this->addTimestampWhereRange( 'rev_timestamp', $params['dir'], + $params['start'], $params['end'] ); } - $this->addTimestampWhereRange( 'rev_timestamp', $params['dir'], - $params['start'], $params['end'] ); - // Dummy to add rev_id to ORDER BY - $this->addWhereRange( 'rev_id', $params['dir'], null, null ); + $sort = ( $params['dir'] === 'newer' ? '' : 'DESC' ); + $this->addOption( 'ORDER BY', [ "rev_timestamp $sort", "rev_id $sort" ] ); // There is only one ID, use it $ids = array_keys( $pageSet->getGoodTitles() ); -- To view, visit https://gerrit.wikimedia.org/r/352632 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ba5e0724945668dad55eec0d09cb7d3fe08e347 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits