From cb3a99fd8ac2f3f0ed9477e70b3aaf51e7a3430f Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Thu, 29 Sep 2011 15:16:35 +0000 Subject: [PATCH] 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. --- includes/QueryPage.php | 2 +- includes/api/ApiQueryQueryPage.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 ) { -- 2.20.1