diff options
Diffstat (limited to 'includes/api/ApiQueryAllCategories.php')
-rw-r--r-- | includes/api/ApiQueryAllCategories.php | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index 79fab727..cc0b71af 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -128,15 +128,15 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { $pages[] = $titleObj; } else { $item = array(); - ApiResult::setContent( $item, $titleObj->getText() ); + ApiResult::setContentValue( $item, 'category', $titleObj->getText() ); if ( isset( $prop['size'] ) ) { $item['size'] = intval( $row->cat_pages ); $item['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files; $item['files'] = intval( $row->cat_files ); $item['subcats'] = intval( $row->cat_subcats ); } - if ( isset( $prop['hidden'] ) && $row->cat_hidden ) { - $item['hidden'] = ''; + if ( isset( $prop['hidden'] ) ) { + $item['hidden'] = (bool)$row->cat_hidden; } $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $item ); if ( !$fit ) { @@ -147,7 +147,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { } if ( is_null( $resultPageSet ) ) { - $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'c' ); + $result->addIndexedTagName( array( 'query', $this->getModuleName() ), 'c' ); } else { $resultPageSet->populateFromTitles( $pages ); } @@ -156,7 +156,9 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { public function getAllowedParams() { return array( 'from' => null, - 'continue' => null, + 'continue' => array( + ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', + ), 'to' => null, 'prefix' => null, 'dir' => array( @@ -189,32 +191,12 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { ); } - public function getParamDescription() { - return array( - 'from' => 'The category to start enumerating from', - 'continue' => 'When more results are available, use this to continue', - 'to' => 'The category to stop enumerating at', - 'prefix' => 'Search for all category titles that begin with this value', - 'dir' => 'Direction to sort in', - 'min' => 'Minimum number of category members', - 'max' => 'Maximum number of category members', - 'limit' => 'How many categories to return', - 'prop' => array( - 'Which properties to get', - ' size - Adds number of pages in the category', - ' hidden - Tags categories that are hidden with __HIDDENCAT__', - ), - ); - } - - public function getDescription() { - return 'Enumerate all categories.'; - } - - public function getExamples() { + protected function getExamplesMessages() { return array( - 'api.php?action=query&list=allcategories&acprop=size', - 'api.php?action=query&generator=allcategories&gacprefix=List&prop=info', + 'action=query&list=allcategories&acprop=size' + => 'apihelp-query+allcategories-example-size', + 'action=query&generator=allcategories&gacprefix=List&prop=info' + => 'apihelp-query+allcategories-example-generator', ); } |