diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:12:12 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:12:12 -0400 |
commit | c9aa36da061816dee256a979c2ff8d2ee41824d9 (patch) | |
tree | 29f7002b80ee984b488bd047dbbd80b36bf892e9 /includes/api/ApiQueryCategories.php | |
parent | b4274e0e33eafb5e9ead9d949ebf031a9fb8363b (diff) | |
parent | d1ba966140d7a60cd5ae4e8667ceb27c1a138592 (diff) |
Merge branch 'archwiki'
# Conflicts:
# skins/ArchLinux.php
# skins/ArchLinux/archlogo.gif
Diffstat (limited to 'includes/api/ApiQueryCategories.php')
-rw-r--r-- | includes/api/ApiQueryCategories.php | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index 5d714f57..1926dd09 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -31,7 +31,7 @@ */ class ApiQueryCategories extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'cl' ); } @@ -48,7 +48,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { } /** - * @param $resultPageSet ApiPageSet + * @param ApiPageSet $resultPageSet */ private function run( $resultPageSet = null ) { if ( $this->getPageSet()->getGoodTitleCount() == 0 ) { @@ -98,8 +98,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { if ( isset( $show['hidden'] ) && isset( $show['!hidden'] ) ) { $this->dieUsageMsg( 'show' ); } - if ( isset( $show['hidden'] ) || isset( $show['!hidden'] ) || isset( $prop['hidden'] ) ) - { + if ( isset( $show['hidden'] ) || isset( $show['!hidden'] ) || isset( $prop['hidden'] ) ) { $this->addOption( 'STRAIGHT_JOIN' ); $this->addTables( array( 'page', 'page_props' ) ); $this->addFieldsIf( 'pp_propname', isset( $prop['hidden'] ) ); @@ -126,9 +125,9 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { $this->addOption( 'ORDER BY', 'cl_to' . $sort ); } else { $this->addOption( 'ORDER BY', array( - 'cl_from' . $sort, - 'cl_to' . $sort - )); + 'cl_from' . $sort, + 'cl_to' . $sort + ) ); } $res = $this->select( __METHOD__ ); @@ -221,51 +220,30 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { return array( 'prop' => array( 'Which additional properties to get for each category', - ' sortkey - Adds the sortkey (hexadecimal string) and sortkey prefix (human-readable part) for the category', + ' sortkey - Adds the sortkey (hexadecimal string) and sortkey prefix', + ' (human-readable part) for the category', ' timestamp - Adds timestamp of when the category was added', ' hidden - Tags categories that are hidden with __HIDDENCAT__', ), 'limit' => 'How many categories to return', 'show' => 'Which kind of categories to show', 'continue' => 'When more results are available, use this to continue', - 'categories' => 'Only list these categories. Useful for checking whether a certain page is in a certain category', + 'categories' => 'Only list these categories. Useful for checking ' . + 'whether a certain page is in a certain category', 'dir' => 'The direction in which to list', ); } - public function getResultProperties() { - return array( - '' => array( - 'ns' => 'namespace', - 'title' => 'string' - ), - 'sortkey' => array( - 'sortkey' => 'string', - 'sortkeyprefix' => 'string' - ), - 'timestamp' => array( - 'timestamp' => 'timestamp' - ), - 'hidden' => array( - 'hidden' => 'boolean' - ) - ); - } - public function getDescription() { - return 'List all categories the page(s) belong to'; - } - - public function getPossibleErrors() { - return array_merge( parent::getPossibleErrors(), array( - array( 'show' ), - ) ); + return 'List all categories the page(s) belong to.'; } public function getExamples() { return array( - 'api.php?action=query&prop=categories&titles=Albert%20Einstein' => 'Get a list of categories [[Albert Einstein]] belongs to', - 'api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info' => 'Get information about all categories used in the [[Albert Einstein]]', + 'api.php?action=query&prop=categories&titles=Albert%20Einstein' + => 'Get a list of categories [[Albert Einstein]] belongs to', + 'api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info' + => 'Get information about all categories used in the [[Albert Einstein]]', ); } |