X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLangLinks.php;h=67f2c9eceaa689f0f088de257e7b52a89490b972;hb=f9f946776f4983336f1746c2f7311c26687df43b;hp=25e534e1006b5620f9c2e99eb08a8523da3b875b;hpb=c1b893812c135ceadc60714f3d3e53365a3fabf9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index 25e534e100..67f2c9ecea 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -44,21 +44,20 @@ class ApiQueryLangLinks extends ApiQueryBase { $prop = array_flip( (array)$params['prop'] ); if ( isset( $params['title'] ) && !isset( $params['lang'] ) ) { - $this->dieUsageMsg( array( 'missingparam', 'lang' ) ); + $this->dieUsageMsg( [ 'missingparam', 'lang' ] ); } // Handle deprecated param $this->requireMaxOneParameter( $params, 'url', 'prop' ); if ( $params['url'] ) { - $this->logFeatureUsage( 'prop=langlinks&llurl' ); - $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() ) ); @@ -75,7 +74,7 @@ class ApiQueryLangLinks extends ApiQueryBase { ); } - //FIXME: (follow-up) To allow extensions to add to the language links, we need + // FIXME: (follow-up) To allow extensions to add to the language links, we need // to load them all, add the extra links, then apply paging. // Should not be terrible, it's not going to be more than a few hundred links. @@ -93,10 +92,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 - ) ); + ] ); } } @@ -111,7 +110,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 ) { @@ -139,48 +138,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() {