From: Brian Wolff Date: Thu, 29 Sep 2011 15:16:35 +0000 (+0000) Subject: Fix handling of qplimit/qpoffset and cachedtimestamp in QueryPage api module X-Git-Tag: 1.31.0-rc.0~27375 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=cb3a99fd8ac2f3f0ed9477e70b3aaf51e7a3430f;p=lhc%2Fweb%2Fwiklou.git Fix handling of qplimit/qpoffset and cachedtimestamp in QueryPage api module Basically api was thinking qplimit was the offset, and qpoffset was the limit. Also remove an extra ! when checking for the cached timestamp which was stopping the display of cachedtimestamp property in the api output. I'm going to tag this 1.18 since this module was introduced in 1.18, and I assume we'd want to fix the limit/offset parameter before the wrong behaviour gets released and people depend on it, etc. --- diff --git a/includes/QueryPage.php b/includes/QueryPage.php index c5a093df83..01d5efd65e 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -423,7 +423,7 @@ abstract class QueryPage extends SpecialPage { } public function getCachedTimestamp() { - if ( !is_null( $this->cachedTimestamp ) ) { + if ( is_null( $this->cachedTimestamp ) ) { $dbr = wfGetDB( DB_SLAVE ); $fname = get_class( $this ) . '::getCachedTimestamp'; $this->cachedTimestamp = $dbr->selectField( 'querycache_info', 'qci_timestamp', diff --git a/includes/api/ApiQueryQueryPage.php b/includes/api/ApiQueryQueryPage.php index c4b3a6febd..41c9c482ad 100644 --- a/includes/api/ApiQueryQueryPage.php +++ b/includes/api/ApiQueryQueryPage.php @@ -103,7 +103,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase { return; } - $res = $qp->doQuery( $params['limit'] + 1, $params['offset'] ); + $res = $qp->doQuery( $params['offset'], $params['limit'] + 1 ); $count = 0; $titles = array(); foreach ( $res as $row ) {