Merge "Replace deprecated usage of ApiBase::dieUsage()"

This commit is contained in:
jenkins-bot 2017-12-03 23:28:46 +00:00 committed by Gerrit Code Review
commit 6c954f6b80
3 changed files with 11 additions and 8 deletions

View file

@ -73,5 +73,8 @@
"apihelp-record-lint-param-revision": "Revision ID that the error was found in",
"apihelp-query+linterstats-description": "Get number of lint errors in each category",
"apihelp-query+linterstats-summary": "Get number of lint errors in each category",
"apihelp-query+linterstats-example-1": "Get number of lint errors in each category"
"apihelp-query+linterstats-example-1": "Get number of lint errors in each category",
"apierror-linter-invalid-ip": "Your IP address has not been whitelisted to report lint errors",
"apierror-linter-invalid-data": "Invalid data",
"apierror-linter-invalid-title": "Invalid, non-existent, or outdated title"
}

View file

@ -77,5 +77,8 @@
"apihelp-record-lint-param-revision": "{{doc-apihelp-param|record-lint|revision}}",
"apihelp-query+linterstats-description": "{{doc-apihelp-description|query+linterstats}}",
"apihelp-query+linterstats-summary": "{{doc-apihelp-summary|query+linterstats}}",
"apihelp-query+linterstats-example-1": "{{doc-apihelp-example|query+linterstats}}"
"apihelp-query+linterstats-example-1": "{{doc-apihelp-example|query+linterstats}}",
"apierror-linter-invalid-ip": "Error message when IP address has not been whitelisted to report lint errors",
"apierror-linter-invalid-data": "Error message when there is invalid data",
"apierror-linter-invalid-title": "Error message when there is invalid, non-existent, or outdated title"
}

View file

@ -40,15 +40,12 @@ class ApiRecordLint extends ApiBase {
array_keys( array_filter( $wgLinterSubmitterWhitelist ) )
);
if ( !$ipSet->match( $this->getRequest()->getIP() ) ) {
$this->dieUsage(
'Your IP address has not been whitelisted to report lint errors',
'invalid-ip'
);
$this->dieWithError( 'apierror-linter-invalid-ip', 'invalid-ip' );
}
$params = $this->extractRequestParams();
$data = FormatJson::decode( $params['data'], true );
if ( !is_array( $data ) ) {
$this->dieUsage( 'Invalid data', 'invalid-data' );
$this->dieWithError( 'apierror-linter-invalid-data', 'invalid-data' );
}
$errors = [];
@ -56,7 +53,7 @@ class ApiRecordLint extends ApiBase {
if ( !$title || !$title->getArticleID()
|| $title->getLatestRevID() != $params['revision']
) {
$this->dieUsage( 'Invalid, non-existent, or outdated title', 'invalid-title' );
$this->dieWithError( 'apierror-linter-invalid-title', 'invalid-title' );
}
$categoryMgr = new CategoryManager();
foreach ( $data as $info ) {