dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Add dotall modifier to EDITSECTION_REGEX"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiPageSet.php
diff --git
a/includes/api/ApiPageSet.php
b/includes/api/ApiPageSet.php
index
46c57b8
..
160ce87
100644
(file)
--- a/
includes/api/ApiPageSet.php
+++ b/
includes/api/ApiPageSet.php
@@
-23,6
+23,7
@@
*
* @file
*/
*
* @file
*/
+use MediaWiki\MediaWikiServices;
/**
* This class contains a list of pages that the client has requested.
/**
* This class contains a list of pages that the client has requested.
@@
-154,10
+155,10
@@
class ApiPageSet extends ApiBase {
}
$generator = $dbSource->getModuleManager()->getModule( $generatorName, null, true );
if ( $generator === null ) {
}
$generator = $dbSource->getModuleManager()->getModule( $generatorName, null, true );
if ( $generator === null ) {
- $this->die
Usage( 'Unknown generator=' . $generatorName
, 'badgenerator' );
+ $this->die
WithError( [ 'apierror-badgenerator-unknown', $generatorName ]
, 'badgenerator' );
}
if ( !$generator instanceof ApiQueryGeneratorBase ) {
}
if ( !$generator instanceof ApiQueryGeneratorBase ) {
- $this->die
Usage( "Module $generatorName cannot be used as a generator"
, 'badgenerator' );
+ $this->die
WithError( [ 'apierror-badgenerator-notgenerator', $generatorName ]
, 'badgenerator' );
}
// Create a temporary pageset to store generator's output,
// add any additional fields generator may need, and execute pageset to populate titles/pageids
}
// Create a temporary pageset to store generator's output,
// add any additional fields generator may need, and execute pageset to populate titles/pageids
@@
-193,13
+194,27
@@
class ApiPageSet extends ApiBase {
}
if ( isset( $this->mParams['pageids'] ) ) {
if ( isset( $dataSource ) ) {
}
if ( isset( $this->mParams['pageids'] ) ) {
if ( isset( $dataSource ) ) {
- $this->dieUsage( "Cannot use 'pageids' at the same time as '$dataSource'", 'multisource' );
+ $this->dieWithError(
+ [
+ 'apierror-invalidparammix-cannotusewith',
+ $this->encodeParamName( 'pageids' ),
+ $this->encodeParamName( $dataSource )
+ ],
+ 'multisource'
+ );
}
$dataSource = 'pageids';
}
if ( isset( $this->mParams['revids'] ) ) {
if ( isset( $dataSource ) ) {
}
$dataSource = 'pageids';
}
if ( isset( $this->mParams['revids'] ) ) {
if ( isset( $dataSource ) ) {
- $this->dieUsage( "Cannot use 'revids' at the same time as '$dataSource'", 'multisource' );
+ $this->dieWithError(
+ [
+ 'apierror-invalidparammix-cannotusewith',
+ $this->encodeParamName( 'revids' ),
+ $this->encodeParamName( $dataSource )
+ ],
+ 'multisource'
+ );
}
$dataSource = 'revids';
}
}
$dataSource = 'revids';
}
@@
-215,9
+230,7
@@
class ApiPageSet extends ApiBase {
break;
case 'revids':
if ( $this->mResolveRedirects ) {
break;
case 'revids':
if ( $this->mResolveRedirects ) {
- $this->setWarning( 'Redirect resolution cannot be used ' .
- 'together with the revids= parameter. Any redirects ' .
- 'the revids= point to have not been resolved.' );
+ $this->addWarning( 'apiwarn-redirectsandrevids' );
}
$this->mResolveRedirects = false;
$this->initFromRevIDs( $this->mParams['revids'] );
}
$this->mResolveRedirects = false;
$this->initFromRevIDs( $this->mParams['revids'] );
@@
-915,7
+928,7
@@
class ApiPageSet extends ApiBase {
}
// Get gender information
}
// Get gender information
- $genderCache =
GenderCache::singleton
();
+ $genderCache =
MediaWikiServices::getInstance()->getGenderCache
();
$genderCache->doQuery( $usernames, __METHOD__ );
}
$genderCache->doQuery( $usernames, __METHOD__ );
}
@@
-1138,7
+1151,7
@@
class ApiPageSet extends ApiBase {
$this->mAllPages[0][$title] = $this->mFakePageId;
$this->mInvalidTitles[$this->mFakePageId] = [
'title' => $title,
$this->mAllPages[0][$title] = $this->mFakePageId;
$this->mInvalidTitles[$this->mFakePageId] = [
'title' => $title,
- 'invalidreason' => $
ex->getMessage(
),
+ 'invalidreason' => $
this->getErrorFormatter()->formatException( $ex, [ 'bc' => true ]
),
];
$this->mFakePageId--;
continue; // There's nothing else we can do
];
$this->mFakePageId--;
continue; // There's nothing else we can do
@@
-1197,7
+1210,7
@@
class ApiPageSet extends ApiBase {
}
}
// Get gender information
}
}
// Get gender information
- $genderCache =
GenderCache::singleton
();
+ $genderCache =
MediaWikiServices::getInstance()->getGenderCache
();
$genderCache->doQuery( $usernames, __METHOD__ );
return $linkBatch;
$genderCache->doQuery( $usernames, __METHOD__ );
return $linkBatch;
@@
-1411,13
+1424,7
@@
class ApiPageSet extends ApiBase {
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_HELP_MSG => [
'api-pageset-param-converttitles',
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_HELP_MSG => [
'api-pageset-param-converttitles',
- new DeferredStringifier(
- function ( IContextSource $context ) {
- return $context->getLanguage()
- ->commaList( LanguageConverter::$languagesWithVariants );
- },
- $this
- )
+ [ Message::listParam( LanguageConverter::$languagesWithVariants, 'text' ) ],
],
],
];
],
],
];