jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/353906 )
Change subject: ApiQueryRevisions: Don't be so tricky handling rvstartid/rvendid
......................................................................
ApiQueryRevisions: Don't be so tricky handling rvstartid/rvendid
If someone strangely supplies 0 as an id, the tricky version confuses
that with null and winds up making the DB layer throw an exception. Just
do it more straightforwardly.
Bug: T165100
Change-Id: Id8376d419e7758c0bf92ad50dd7b7ac283a73101
(cherry picked from commit 9c8e3214f3c31ddc7b5f7376ba95e2b4d0ec42aa)
---
M includes/api/ApiQueryRevisions.php
1 file changed, 10 insertions(+), 10 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/api/ApiQueryRevisions.php
b/includes/api/ApiQueryRevisions.php
index b0a8468..a4f0315 100644
--- a/includes/api/ApiQueryRevisions.php
+++ b/includes/api/ApiQueryRevisions.php
@@ -219,26 +219,26 @@
}
// Convert startid/endid to timestamps (T163532)
- if ( $params['startid'] !== null || $params['endid']
!== null ) {
- $ids = [
- (int)$params['startid'] => true,
- (int)$params['endid'] => true,
- ];
- unset( $ids[0] ); // null
- $ids = array_keys( $ids );
-
+ $revids = [];
+ if ( $params['startid'] !== null ) {
+ $revids[] = (int)$params['startid'];
+ }
+ if ( $params['endid'] !== null ) {
+ $revids[] = (int)$params['endid'];
+ }
+ if ( $revids ) {
$db = $this->getDB();
$sql = $db->unionQueries( [
$db->selectSQLText(
'revision',
[ 'id' => 'rev_id', 'ts' =>
'rev_timestamp' ],
- [ 'rev_id' => $ids ],
+ [ 'rev_id' => $revids ],
__METHOD__
),
$db->selectSQLText(
'archive',
[ 'id' => 'ar_rev_id', 'ts' =>
'ar_timestamp' ],
- [ 'ar_rev_id' => $ids ],
+ [ 'ar_rev_id' => $revids ],
__METHOD__
),
], false );
--
To view, visit https://gerrit.wikimedia.org/r/353906
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id8376d419e7758c0bf92ad50dd7b7ac283a73101
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.30.0-wmf.1
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits