summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryCategoryInfo.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-06-10 13:00:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2009-06-10 13:00:47 +0200
commit72e90545454c0e014318fa3c81658e035aac58c1 (patch)
tree9212e3f46868989c4d57ae9a5c8a1a80e4dc0702 /includes/api/ApiQueryCategoryInfo.php
parent565a0ccc371ec1a2a0e9b39487cbac18e6f60e25 (diff)
applying patch to version 1.15.0
Diffstat (limited to 'includes/api/ApiQueryCategoryInfo.php')
-rw-r--r--includes/api/ApiQueryCategoryInfo.php43
1 files changed, 33 insertions, 10 deletions
diff --git a/includes/api/ApiQueryCategoryInfo.php b/includes/api/ApiQueryCategoryInfo.php
index f83c4a5b..49e4554e 100644
--- a/includes/api/ApiQueryCategoryInfo.php
+++ b/includes/api/ApiQueryCategoryInfo.php
@@ -29,7 +29,7 @@ if (!defined('MEDIAWIKI')) {
}
/**
- * This query adds <categories> subelement to all pages with the list of images embedded into those pages.
+ * This query adds the <categories> subelement to all pages with the list of categories the page is in
*
* @ingroup API
*/
@@ -39,7 +39,8 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
parent :: __construct($query, $moduleName, 'ci');
}
- public function execute() {
+ public function execute() {
+ $params = $this->extractRequestParams();
$alltitles = $this->getPageSet()->getAllTitlesByNamespace();
if ( empty( $alltitles[NS_CATEGORY] ) ) {
return;
@@ -65,27 +66,49 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
'pp_propname' => 'hiddencat')),
));
$this->addFields(array('cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'pp_propname AS cat_hidden'));
- $this->addWhere(array('cat_title' => $cattitles));
+ $this->addWhere(array('cat_title' => $cattitles));
+ if(!is_null($params['continue']))
+ {
+ $title = $this->getDB()->addQuotes($params['continue']);
+ $this->addWhere("cat_title >= $title");
+ }
+ $this->addOption('ORDER BY', 'cat_title');
$db = $this->getDB();
$res = $this->select(__METHOD__);
- $data = array();
$catids = array_flip($cattitles);
while($row = $db->fetchObject($res))
{
$vals = array();
- $vals['size'] = $row->cat_pages;
+ $vals['size'] = intval($row->cat_pages);
$vals['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files;
- $vals['files'] = $row->cat_files;
- $vals['subcats'] = $row->cat_subcats;
+ $vals['files'] = intval($row->cat_files);
+ $vals['subcats'] = intval($row->cat_subcats);
if($row->cat_hidden)
$vals['hidden'] = '';
- $this->addPageSubItems($catids[$row->cat_title], $vals);
+ $fit = $this->addPageSubItems($catids[$row->cat_title], $vals);
+ if(!$fit)
+ {
+ $this->setContinueEnumParameter('continue', $row->cat_title);
+ break;
+ }
}
$db->freeResult($res);
}
+ public function getAllowedParams() {
+ return array (
+ 'continue' => null,
+ );
+ }
+
+ public function getParamDescription() {
+ return array (
+ 'continue' => 'When more results are available, use this to continue',
+ );
+ }
+
public function getDescription() {
return 'Returns information about the given categories';
}
@@ -95,6 +118,6 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
}
public function getVersion() {
- return __CLASS__ . ': $Id: ApiQueryCategoryInfo.php 44590 2008-12-14 20:24:23Z catrope $';
+ return __CLASS__ . ': $Id: ApiQueryCategoryInfo.php 47865 2009-02-27 16:03:01Z catrope $';
}
-}
+} \ No newline at end of file