API:
[lhc/web/wiklou.git] / includes / api / ApiQueryCategories.php
index f27de7e..2283a8b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * 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
@@ -29,6 +29,8 @@ if (!defined('MEDIAWIKI')) {
 }
 
 /**
+ * A query module to enumerate categories the set of pages belong to.
+ * 
  * @addtogroup API
  */
 class ApiQueryCategories extends ApiQueryGeneratorBase {
@@ -93,8 +95,6 @@ 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);
@@ -112,9 +112,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
 
                        $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);
                }
@@ -122,14 +120,6 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                $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 (
@@ -148,12 +138,12 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
        }
 
        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"
@@ -164,4 +154,4 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                return __CLASS__ . ': $Id$';
        }
 }
-?>
+