Fix handling of qplimit/qpoffset and cachedtimestamp in QueryPage api module
authorBrian Wolff <bawolff@users.mediawiki.org>
Thu, 29 Sep 2011 15:16:35 +0000 (15:16 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Thu, 29 Sep 2011 15:16:35 +0000 (15:16 +0000)
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
includes/api/ApiQueryQueryPage.php

index c5a093d..01d5efd 100644 (file)
@@ -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',
index c4b3a6f..41c9c48 100644 (file)
@@ -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 ) {