$prop = array_flip( (array)$params['prop'] );
if ( isset( $params['title'] ) && !isset( $params['lang'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'lang' ) );
+ $this->dieWithError(
+ [
+ 'apierror-invalidparammix-mustusewith',
+ $this->encodeParamName( 'title' ),
+ $this->encodeParamName( 'lang' ),
+ ],
+ 'invalidparammix'
+ );
}
// Handle deprecated param
$this->requireMaxOneParameter( $params, 'url', 'prop' );
if ( $params['url'] ) {
- $prop = array( 'url' => 1 );
+ $prop = [ 'url' => 1 ];
}
- $this->addFields( array(
+ $this->addFields( [
'll_from',
'll_lang',
'll_title'
- ) );
+ ] );
$this->addTables( 'langlinks' );
$this->addWhereFld( 'll_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
$this->addOption( 'ORDER BY', 'll_lang' . $sort );
} else {
- $this->addOption( 'ORDER BY', array(
+ $this->addOption( 'ORDER BY', [
'll_from' . $sort,
'll_lang' . $sort
- ) );
+ ] );
}
}
$this->setContinueEnumParameter( 'continue', "{$row->ll_from}|{$row->ll_lang}" );
break;
}
- $entry = array( 'lang' => $row->ll_lang );
+ $entry = [ 'lang' => $row->ll_lang ];
if ( isset( $prop['url'] ) ) {
$title = Title::newFromText( "{$row->ll_lang}:{$row->ll_title}" );
if ( $title ) {
public function getAllowedParams() {
global $wgContLang;
- return array(
- 'prop' => array(
+ return [
+ 'prop' => [
ApiBase::PARAM_ISMULTI => true,
- ApiBase::PARAM_TYPE => array(
+ ApiBase::PARAM_TYPE => [
'url',
'langname',
'autonym',
- ),
- ApiBase::PARAM_HELP_MSG_PER_VALUE => array(),
- ),
+ ],
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
+ ],
'lang' => null,
'title' => null,
- 'dir' => array(
+ 'dir' => [
ApiBase::PARAM_DFLT => 'ascending',
- ApiBase::PARAM_TYPE => array(
+ ApiBase::PARAM_TYPE => [
'ascending',
'descending'
- )
- ),
+ ]
+ ],
'inlanguagecode' => $wgContLang->getCode(),
- '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
- ),
- 'continue' => array(
+ ],
+ 'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
- ),
- 'url' => array(
+ ],
+ 'url' => [
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_DEPRECATED => true,
- ),
- );
+ ],
+ ];
}
protected function getExamplesMessages() {
- return array(
+ return [
'action=query&prop=langlinks&titles=Main%20Page&redirects='
=> 'apihelp-query+langlinks-example-simple',
- );
+ ];
}
public function getHelpUrls() {
- return 'https://www.mediawiki.org/wiki/API:Langlinks';
+ return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Langlinks';
}
}