X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryAllCategories.php;h=614b06c0b53b5653a319cf55ddfc06f87cdd6b38;hb=4958f44622f04dda97bf69586420fe98b4f5c9ec;hp=0711c9029236b5d346997e895bad465994fa459a;hpb=3eb79b48c89277eaa00a4eeadfbd5b2bf56e648e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index 0711c90292..614b06c0b5 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -94,23 +94,23 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { $this->addOption( 'ORDER BY', 'cat_title' . $sort ); $prop = array_flip( $params['prop'] ); - $this->addFieldsIf( array( 'cat_pages', 'cat_subcats', 'cat_files' ), isset( $prop['size'] ) ); + $this->addFieldsIf( [ 'cat_pages', 'cat_subcats', 'cat_files' ], isset( $prop['size'] ) ); if ( isset( $prop['hidden'] ) ) { - $this->addTables( array( 'page', 'page_props' ) ); - $this->addJoinConds( array( - 'page' => array( 'LEFT JOIN', array( + $this->addTables( [ 'page', 'page_props' ] ); + $this->addJoinConds( [ + 'page' => [ 'LEFT JOIN', [ 'page_namespace' => NS_CATEGORY, - 'page_title=cat_title' ) ), - 'page_props' => array( 'LEFT JOIN', array( + 'page_title=cat_title' ] ], + 'page_props' => [ 'LEFT JOIN', [ 'pp_page=page_id', - 'pp_propname' => 'hiddencat' ) ), - ) ); - $this->addFields( array( 'cat_hidden' => 'pp_propname' ) ); + 'pp_propname' => 'hiddencat' ] ], + ] ); + $this->addFields( [ 'cat_hidden' => 'pp_propname' ] ); } $res = $this->select( __METHOD__ ); - $pages = array(); + $pages = []; $result = $this->getResult(); $count = 0; @@ -127,7 +127,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { if ( !is_null( $resultPageSet ) ) { $pages[] = $titleObj; } else { - $item = array(); + $item = []; ApiResult::setContentValue( $item, 'category', $titleObj->getText() ); if ( isset( $prop['size'] ) ) { $item['size'] = intval( $row->cat_pages ); @@ -138,7 +138,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { if ( isset( $prop['hidden'] ) ) { $item['hidden'] = (bool)$row->cat_hidden; } - $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $item ); + $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $item ); if ( !$fit ) { $this->setContinueEnumParameter( 'continue', $row->cat_title ); break; @@ -147,58 +147,56 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { } if ( is_null( $resultPageSet ) ) { - $result->addIndexedTagName( array( 'query', $this->getModuleName() ), 'c' ); + $result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'c' ); } else { $resultPageSet->populateFromTitles( $pages ); } } public function getAllowedParams() { - return array( + return [ 'from' => null, - 'continue' => array( + 'continue' => [ ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', - ), + ], 'to' => null, 'prefix' => null, - 'dir' => array( + 'dir' => [ ApiBase::PARAM_DFLT => 'ascending', - ApiBase::PARAM_TYPE => array( + ApiBase::PARAM_TYPE => [ 'ascending', 'descending' - ), - ), - 'min' => array( - ApiBase::PARAM_DFLT => null, + ], + ], + 'min' => [ ApiBase::PARAM_TYPE => 'integer' - ), - 'max' => array( - ApiBase::PARAM_DFLT => null, + ], + 'max' => [ ApiBase::PARAM_TYPE => 'integer' - ), - 'limit' => array( + ], + 'limit' => [ ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 - ), - 'prop' => array( - ApiBase::PARAM_TYPE => array( 'size', 'hidden' ), + ], + 'prop' => [ + ApiBase::PARAM_TYPE => [ 'size', 'hidden' ], ApiBase::PARAM_DFLT => '', ApiBase::PARAM_ISMULTI => true, - ApiBase::PARAM_HELP_MSG_PER_VALUE => array(), - ), - ); + ApiBase::PARAM_HELP_MSG_PER_VALUE => [], + ], + ]; } protected function getExamplesMessages() { - return array( + return [ 'action=query&list=allcategories&acprop=size' => 'apihelp-query+allcategories-example-size', 'action=query&generator=allcategories&gacprefix=List&prop=info' => 'apihelp-query+allcategories-example-generator', - ); + ]; } public function getHelpUrls() {