Fix usage of ApiBase::PARAM_* deprecated constants

The ones that are replaced with ParamValidator

Bug: T275455
Change-Id: I773e3ec3072bb25c455c080b8cd5870b3b27d23e
This commit is contained in:
gerritbot 2022-04-04 01:27:56 +02:00 committed by Ladsgroup
parent e7dccae886
commit 044ba77182
2 changed files with 19 additions and 17 deletions

View file

@ -25,6 +25,7 @@ use ApiQuery;
use ApiQueryBase;
use ApiResult;
use Title;
use Wikimedia\ParamValidator\ParamValidator;
use Wikimedia\ParamValidator\TypeDef\IntegerDef;
class ApiQueryLintErrors extends ApiQueryBase {
@ -116,31 +117,31 @@ class ApiQueryLintErrors extends ApiQueryBase {
$visibleCats = ( new CategoryManager() )->getVisibleCategories();
return [
'categories' => [
ApiBase::PARAM_TYPE => $visibleCats,
ApiBase::PARAM_ISMULTI => true,
ParamValidator::PARAM_TYPE => $visibleCats,
ParamValidator::PARAM_ISMULTI => true,
// Default is to show all categories
ApiBase::PARAM_DFLT => implode( '|', $visibleCats ),
ParamValidator::PARAM_DEFAULT => implode( '|', $visibleCats ),
],
'limit' => [
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_TYPE => 'limit',
ParamValidator::PARAM_DEFAULT => 10,
ParamValidator::PARAM_TYPE => 'limit',
IntegerDef::PARAM_MIN => 1,
IntegerDef::PARAM_MAX => ApiBase::LIMIT_BIG1,
IntegerDef::PARAM_MAX2 => ApiBase::LIMIT_BIG2
],
'namespace' => [
ApiBase::PARAM_TYPE => 'namespace',
ApiBase::PARAM_ISMULTI => true,
ParamValidator::PARAM_TYPE => 'namespace',
ParamValidator::PARAM_ISMULTI => true,
],
'pageid' => [
ApiBase::PARAM_TYPE => 'integer',
ApiBase::PARAM_ISMULTI => true,
ParamValidator::PARAM_TYPE => 'integer',
ParamValidator::PARAM_ISMULTI => true,
],
'title' => [
ApiBase::PARAM_TYPE => 'string',
ParamValidator::PARAM_TYPE => 'string',
],
'from' => [
ApiBase::PARAM_TYPE => 'integer',
ParamValidator::PARAM_TYPE => 'integer',
],
];
}

View file

@ -23,6 +23,7 @@ namespace MediaWiki\Linter;
use ApiBase;
use FormatJson;
use Wikimedia\IPSet;
use Wikimedia\ParamValidator\ParamValidator;
/**
* API module for an external service to record
@ -60,16 +61,16 @@ class ApiRecordLint extends ApiBase {
public function getAllowedParams() {
return [
'data' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true,
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => true,
],
'page' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true,
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => true,
],
'revision' => [
ApiBase::PARAM_TYPE => 'integer',
ApiBase::PARAM_REQUIRED => true,
ParamValidator::PARAM_TYPE => 'integer',
ParamValidator::PARAM_REQUIRED => true,
],
];
}