mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-27 17:20:12 +00:00
Merge "Replace deprecated usage of ApiBase::dieUsage()"
This commit is contained in:
commit
6c954f6b80
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in a new issue