X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryPagesWithProp.php;h=e90356d33e0ebd5f7872c4054db5ff79175681c8;hb=886b625f1f69c9c8a6d5d1688af75cb5ce3c6165;hp=ad641a46bdea890448189e59d473839909eb73a3;hpb=4590c637f5db68f5483f45597fbe51d511f1d1b1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryPagesWithProp.php b/includes/api/ApiQueryPagesWithProp.php index ad641a46bd..e90356d33e 100644 --- a/includes/api/ApiQueryPagesWithProp.php +++ b/includes/api/ApiQueryPagesWithProp.php @@ -61,13 +61,13 @@ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase { $fld_value = isset( $prop['value'] ); if ( $resultPageSet === null ) { - $this->addFields( array( 'page_id' ) ); - $this->addFieldsIf( array( 'page_title', 'page_namespace' ), $fld_title ); + $this->addFields( [ 'page_id' ] ); + $this->addFieldsIf( [ 'page_title', 'page_namespace' ], $fld_title ); $this->addFieldsIf( 'pp_value', $fld_value ); } else { $this->addFields( $resultPageSet->getPageTableFields() ); } - $this->addTables( array( 'page_props', 'page' ) ); + $this->addTables( [ 'page_props', 'page' ] ); $this->addWhere( 'pp_page=page_id' ); $this->addWhereFld( 'pp_propname', $params['propname'] ); @@ -99,9 +99,9 @@ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase { } if ( $resultPageSet === null ) { - $vals = array( + $vals = [ ApiResult::META_TYPE => 'assoc', - ); + ]; if ( $fld_ids ) { $vals['pageid'] = (int)$row->page_id; } @@ -112,7 +112,7 @@ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase { if ( $fld_value ) { $vals['value'] = $row->pp_value; } - $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals ); + $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $vals ); if ( !$fit ) { $this->setContinueEnumParameter( 'continue', $row->page_id ); break; @@ -123,56 +123,56 @@ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase { } if ( $resultPageSet === null ) { - $result->addIndexedTagName( array( 'query', $this->getModuleName() ), 'page' ); + $result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'page' ); } } public function getAllowedParams() { - return array( - 'propname' => array( + return [ + 'propname' => [ ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true, - ), - 'prop' => array( + ], + 'prop' => [ ApiBase::PARAM_DFLT => 'ids|title', ApiBase::PARAM_ISMULTI => true, - ApiBase::PARAM_TYPE => array( + ApiBase::PARAM_TYPE => [ 'ids', 'title', 'value', - ), - ApiBase::PARAM_HELP_MSG_PER_VALUE => array(), - ), - 'continue' => array( + ], + ApiBase::PARAM_HELP_MSG_PER_VALUE => [], + ], + 'continue' => [ ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', - ), - 'limit' => array( + ], + 'limit' => [ ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 - ), - 'dir' => array( + ], + 'dir' => [ ApiBase::PARAM_DFLT => 'ascending', - ApiBase::PARAM_TYPE => array( + ApiBase::PARAM_TYPE => [ 'ascending', 'descending', - ) - ), - ); + ] + ], + ]; } protected function getExamplesMessages() { - return array( + return [ 'action=query&list=pageswithprop&pwppropname=displaytitle&pwpprop=ids|title|value' => 'apihelp-query+pageswithprop-example-simple', 'action=query&generator=pageswithprop&gpwppropname=notoc&prop=info' => 'apihelp-query+pageswithprop-example-generator', - ); + ]; } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Pageswithprop'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Pageswithprop'; } }