r47050 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47049‎ | r47050 | r47051 >
Date:19:54, 9 February 2009
Author:catrope
Status:deferred
Tags:
Comment:
API: Query-continue prop=categoryinfo by cat_title rather than offset. Suggested by Brad Jorsch
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryCategoryInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryCategoryInfo.php
@@ -69,17 +69,15 @@
7070 $this->addWhere(array('cat_title' => $cattitles));
7171 if(!is_null($params['continue']))
7272 {
73 - // We need to set a LIMIT in order to be able to set
74 - // an OFFSET
75 - $this->addOption('LIMIT', count($titles));
76 - $this->addOption('OFFSET', $params['continue']);
77 - }
 73+ $title = $this->getDB()->addQuotes($params['continue']);
 74+ $this->addWhere("cat_title >= $title");
 75+ }
 76+ $this->addOption('ORDER BY', 'cat_title');
7877
7978 $db = $this->getDB();
8079 $res = $this->select(__METHOD__);
8180
8281 $catids = array_flip($cattitles);
83 - $count = (int)@$params['continue'];
8482 while($row = $db->fetchObject($res))
8583 {
8684 $vals = array();
@@ -92,10 +90,9 @@
9391 $fit = $this->addPageSubItems($catids[$row->cat_title], $vals);
9492 if(!$fit)
9593 {
96 - $this->setContinueEnumParameter('continue', $count);
 94+ $this->setContinueEnumParameter('continue', $row->cat_title);
9795 break;
9896 }
99 - $count++;
10097 }
10198 $db->freeResult($res);
10299 }

Status & tagging log