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

View file

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