X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLangLinks.php;h=55e3c85265a58574f6ac2e4fe5a461dd11b0c867;hb=32f52cbacd760f8c1cb60345fe0310cbc8d7a4ec;hp=f964c7a3ebce8da88a76f543ba4f126c2d55c62a;hpb=70fcdfe0f436f19de4cb6e0ccb5990d44f43c100;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index f964c7a3eb..55e3c85265 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -44,20 +44,27 @@ class ApiQueryLangLinks extends ApiQueryBase { $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() ) ); @@ -92,10 +99,10 @@ class ApiQueryLangLinks extends ApiQueryBase { 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 - ) ); + ] ); } } @@ -110,7 +117,7 @@ class ApiQueryLangLinks extends ApiQueryBase { $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 ) { @@ -138,48 +145,48 @@ class ApiQueryLangLinks extends ApiQueryBase { 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() {