$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;
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 );
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;
}
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(
+ ],
+ ],
+ 'min' => [
ApiBase::PARAM_TYPE => 'integer'
- ),
- 'max' => array(
+ ],
+ '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() {
- return 'https://www.mediawiki.org/wiki/API:Allcategories';
+ return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Allcategories';
}
}