jenkins-bot has submitted this change and it was merged.

Change subject: (bug 46787) API: Fix rccontinue handling
......................................................................


(bug 46787) API: Fix rccontinue handling

There are several bugs in Icc43b62f:
* When handing the continuation, the code checks for dir=descending when
  the actual value is dir=older.
* When the above is fixed, the continuation code assumes "ORDER BY
  rc_timestamp DESC, rc_id ASC", which would filesort.
* rc_id is not added to the ORDER BY clause anyway.

Bug: 46787
Change-Id: Ia6ebd4ea0458b8013d4ecb71954dcfbdacff2c00
---
M includes/api/ApiQueryRecentChanges.php
1 file changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Demon: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiQueryRecentChanges.php 
b/includes/api/ApiQueryRecentChanges.php
index 72e80b8..8aceab2 100644
--- a/includes/api/ApiQueryRecentChanges.php
+++ b/includes/api/ApiQueryRecentChanges.php
@@ -159,15 +159,20 @@
 
                        $timestamp = $this->getDB()->addQuotes( wfTimestamp( 
TS_MW, $cont[0] ) );
                        $id = intval( $cont[1] );
-                       $op = $params['dir'] == 'descending' ? '<' : '>';
+                       $op = $params['dir'] === 'older' ? '<' : '>';
 
                        $this->addWhere(
                                "rc_timestamp $op $timestamp OR " .
                                "(rc_timestamp = $timestamp AND " .
-                               "rc_id <= $id)"
+                               "rc_id $op= $id)"
                        );
                }
 
+               $order = $params['dir'] === 'older' ? 'DESC' : 'ASC';
+               $this->addOption( 'ORDER BY', array(
+                       "rc_timestamp $order",
+                       "rc_id $order",
+               ) );
 
                $this->addWhereFld( 'rc_namespace', $params['namespace'] );
                $this->addWhereFld( 'rc_deleted', 0 );

-- 
To view, visit https://gerrit.wikimedia.org/r/57067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6ebd4ea0458b8013d4ecb71954dcfbdacff2c00
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Demon <ch...@wikimedia.org>
Gerrit-Reviewer: Greg Grossmeier <g...@wikimedia.org>
Gerrit-Reviewer: MarkAHershberger <mhershber...@wikimedia.org>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Yurik <yu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to