X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQuery.php;h=987bb99289f615d2c25e17966069a16ed0bdd8d3;hb=0cb2a09b6d0c7318e49d5ef7c5989e9005a625ff;hp=16bd725e3cb0a986a098c345bfa8363d4dad96df;hpb=adae996840b9e782f6e14b21c433a83e37c3a74e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index 16bd725e3c..987bb99289 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -24,6 +24,8 @@ * @file */ +use Wikimedia\Rdbms\IDatabase; + /** * This is the main query class. It behaves similar to ApiMain: based on the * parameters given, it will create a list of titles to work on (an ApiPageSet @@ -168,7 +170,7 @@ class ApiQuery extends ApiBase { * @param string $name Name to assign to the database connection * @param int $db One of the DB_* constants * @param array $groups Query groups - * @return Database + * @return IDatabase */ public function getNamedDB( $name, $db, $groups ) { if ( !array_key_exists( $name, $this->mNamedDB ) ) { @@ -243,7 +245,7 @@ class ApiQuery extends ApiBase { $cacheMode = $this->mPageSet->getCacheMode(); // Execute all unfinished modules - /** @var $module ApiQueryBase */ + /** @var ApiQueryBase $module */ foreach ( $modules as $module ) { $params = $module->extractRequestParams(); $cacheMode = $this->mergeCacheMode( @@ -310,7 +312,7 @@ class ApiQuery extends ApiBase { ApiBase::dieDebug( __METHOD__, 'Error instantiating module' ); } if ( !$wasPosted && $instance->mustBePosted() ) { - $this->dieUsageMsgOrDebug( [ 'mustbeposted', $moduleName ] ); + $this->dieWithErrorOrDebug( [ 'apierror-mustbeposted', $moduleName ] ); } // Ignore duplicates. TODO 2.0: die()? if ( !array_key_exists( $moduleName, $modules ) ) { @@ -379,7 +381,7 @@ class ApiQuery extends ApiBase { ]; } // Report special pages - /** @var $title Title */ + /** @var Title $title */ foreach ( $pageSet->getSpecialTitles() as $fakeId => $title ) { $vals = []; ApiQueryBase::addTitleInfo( $vals, $title ); @@ -415,11 +417,7 @@ class ApiQuery extends ApiBase { } if ( !$fit ) { - $this->dieUsage( - 'The value of $wgAPIMaxResultSize on this wiki is ' . - 'too small to hold basic result information', - 'badconfig' - ); + $this->dieWithError( 'apierror-badconfig-resulttoosmall', 'badconfig' ); } if ( $this->mParams['export'] ) { @@ -436,7 +434,7 @@ class ApiQuery extends ApiBase { $titles = $pageSet->getGoodTitles(); if ( count( $titles ) ) { $user = $this->getUser(); - /** @var $title Title */ + /** @var Title $title */ foreach ( $titles as $title ) { if ( $title->userCan( 'read', $user ) ) { $exportTitles[] = $title; @@ -540,10 +538,10 @@ class ApiQuery extends ApiBase { public function getHelpUrls() { return [ - 'https://www.mediawiki.org/wiki/API:Query', - 'https://www.mediawiki.org/wiki/API:Meta', - 'https://www.mediawiki.org/wiki/API:Properties', - 'https://www.mediawiki.org/wiki/API:Lists', + 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Query', + 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Meta', + 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Properties', + 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Lists', ]; } }