*
* API for MediaWiki 1.8+
*
- * Copyright (C) 2006 Yuri Astrakhan <FirstnameLastname@gmail.com>
+ * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
/**
+ * A query module to enumerate categories the set of pages belong to.
+ *
* @addtogroup API
*/
class ApiQueryCategories extends ApiQueryGeneratorBase {
}
$title = Title :: makeTitle(NS_CATEGORY, $row->cl_to);
- // do not check userCanRead() -- page content is already accessible,
- // and category is listed there.
$vals = array();
ApiQueryBase :: addTitleInfo($vals, $title);
$titles = array();
while ($row = $db->fetchObject($res)) {
- $title = Title :: makeTitle(NS_CATEGORY, $row->cl_to);
- if($title->userCanRead())
- $titles[] = $title;
+ $titles[] = Title :: makeTitle(NS_CATEGORY, $row->cl_to);
}
$resultPageSet->populateFromTitles($titles);
}
$db->freeResult($res);
}
- private function addPageSubItems($pageId, $data) {
- $result = $this->getResult();
- $result->setIndexedTagName($data, 'cl');
- $result->addValue(array ('query', 'pages', intval($pageId)),
- 'categories',
- $data);
- }
-
protected function getAllowedParams() {
return array (
'prop' => array (
}
protected function getDescription() {
- return 'Returns all links from the given page(s)';
+ return 'List all categories the page(s) belong to';
}
protected function getExamples() {
return array (
- "Get a list of categories used in the [[Albert Einstein]]:",
+ "Get a list of categories [[Albert Einstein]] belongs to:",
" api.php?action=query&prop=categories&titles=Albert%20Einstein",
"Get information about all categories used in the [[Albert Einstein]]:",
" api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info"
return __CLASS__ . ': $Id$';
}
}
-?>
+