From: Brad Jorsch Date: Tue, 2 Apr 2013 14:01:53 +0000 (-0400) Subject: (bug 46787) API: Fix rccontinue handling X-Git-Tag: 1.31.0-rc.0~20135^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=661e5e5b145509df4a7c32f144293faa1998c0de;p=lhc%2Fweb%2Fwiklou.git (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 --- diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 72e80b8783..8aceab22bd 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -159,15 +159,20 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $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 );