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/ApiQueryAllCategories.php | |
parent | b4274e0e33eafb5e9ead9d949ebf031a9fb8363b (diff) | |
parent | d1ba966140d7a60cd5ae4e8667ceb27c1a138592 (diff) |
Merge branch 'archwiki'
# Conflicts:
# skins/ArchLinux.php
# skins/ArchLinux/archlogo.gif
Diffstat (limited to 'includes/api/ApiQueryAllCategories.php')
-rw-r--r-- | includes/api/ApiQueryAllCategories.php | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index 3f5c6ee7..79fab727 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -32,7 +32,7 @@ */ class ApiQueryAllCategories extends ApiQueryGeneratorBase { - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'ac' ); } @@ -49,7 +49,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { } /** - * @param $resultPageSet ApiPageSet + * @param ApiPageSet $resultPageSet */ private function run( $resultPageSet = null ) { $db = $this->getDB(); @@ -67,8 +67,12 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { } $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' ); - $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) ); - $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) ); + $from = ( $params['from'] === null + ? null + : $this->titlePartToKey( $params['from'], NS_CATEGORY ) ); + $to = ( $params['to'] === null + ? null + : $this->titlePartToKey( $params['to'], NS_CATEGORY ) ); $this->addWhereRange( 'cat_title', $dir, $from, $to ); $min = $params['min']; @@ -80,7 +84,9 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { } if ( isset( $params['prefix'] ) ) { - $this->addWhere( 'cat_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) ); + $this->addWhere( 'cat_title' . $db->buildLike( + $this->titlePartToKey( $params['prefix'], NS_CATEGORY ), + $db->anyString() ) ); } $this->addOption( 'LIMIT', $params['limit'] + 1 ); @@ -109,8 +115,9 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { $result = $this->getResult(); $count = 0; foreach ( $res as $row ) { - if ( ++ $count > $params['limit'] ) { - // We've reached the one extra which shows that there are additional cats to be had. Stop here... + if ( ++$count > $params['limit'] ) { + // We've reached the one extra which shows that there are + // additional cats to be had. Stop here... $this->setContinueEnumParameter( 'continue', $row->cat_title ); break; } @@ -200,25 +207,8 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { ); } - public function getResultProperties() { - return array( - '' => array( - '*' => 'string' - ), - 'size' => array( - 'size' => 'integer', - 'pages' => 'integer', - 'files' => 'integer', - 'subcats' => 'integer' - ), - 'hidden' => array( - 'hidden' => 'boolean' - ) - ); - } - public function getDescription() { - return 'Enumerate all categories'; + return 'Enumerate all categories.'; } public function getExamples() { |