From f45fefec0eb8bfbaf26e40ab33c6e476a710772f Mon Sep 17 00:00:00 2001 From: Reedy Date: Mon, 6 Jun 2022 02:24:41 +0100 Subject: [PATCH] api: Replace numerous more deprecated constants Change-Id: I498a315b8b4b56d5e2f939e797adbe0487cd7d07 --- includes/api/ApiBase.php | 20 ++++++++++---------- includes/api/ApiBlock.php | 2 +- includes/api/ApiCheckToken.php | 2 +- includes/api/ApiComparePages.php | 10 +++++----- includes/api/ApiDelete.php | 4 ++-- includes/api/ApiEditPage.php | 4 ++-- includes/api/ApiExpandTemplates.php | 2 +- includes/api/ApiFormatBase.php | 2 +- includes/api/ApiHelp.php | 2 +- includes/api/ApiLogin.php | 2 +- includes/api/ApiOpenSearch.php | 2 +- includes/api/ApiPageSet.php | 5 +++-- includes/api/ApiParamInfo.php | 8 ++++---- includes/api/ApiParse.php | 9 +++++---- includes/api/ApiProtect.php | 2 +- includes/api/ApiQueryAllLinks.php | 3 ++- includes/api/ApiQueryCategoryMembers.php | 4 ++-- includes/api/ApiQueryIWLinks.php | 2 +- includes/api/ApiQueryInfo.php | 3 ++- includes/api/ApiQueryLangLinks.php | 2 +- includes/api/ApiQueryLanguageinfo.php | 11 ++++++----- includes/api/ApiQueryLinks.php | 3 ++- includes/api/ApiQueryLogEvents.php | 3 ++- includes/api/ApiQueryRandom.php | 2 +- includes/api/ApiQueryRecentChanges.php | 3 ++- includes/api/ApiQueryRevisionsBase.php | 19 ++++++++++--------- includes/api/ApiQuerySearch.php | 3 ++- includes/api/ApiQueryStashImageInfo.php | 2 +- includes/api/ApiQueryTokens.php | 2 +- includes/api/ApiQueryUserContribs.php | 2 +- includes/api/ApiQueryUserInfo.php | 2 +- includes/api/ApiQueryWatchlist.php | 2 +- includes/api/ApiQueryWatchlistRaw.php | 2 +- includes/api/ApiUnblock.php | 2 +- includes/api/ApiUpload.php | 4 ++-- includes/api/ApiUserrights.php | 2 +- 36 files changed, 82 insertions(+), 72 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 6d4e3a493cb..a524059b710 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1786,9 +1786,9 @@ abstract class ApiBase extends ContextSource { if ( $this->needsToken() ) { $params['token'] = [ - self::PARAM_TYPE => 'string', - self::PARAM_REQUIRED => true, - self::PARAM_SENSITIVE => true, + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => true, + ParamValidator::PARAM_SENSITIVE => true, self::PARAM_HELP_MSG => [ 'api-help-param-token', $this->needsToken(), @@ -1833,11 +1833,11 @@ abstract class ApiBase extends ContextSource { } $msgs[$param] = [ $msg ]; - if ( isset( $settings[self::PARAM_TYPE] ) && - $settings[self::PARAM_TYPE] === 'submodule' + if ( isset( $settings[ParamValidator::PARAM_TYPE] ) && + $settings[ParamValidator::PARAM_TYPE] === 'submodule' ) { - if ( isset( $settings[self::PARAM_SUBMODULE_MAP] ) ) { - $map = $settings[self::PARAM_SUBMODULE_MAP]; + if ( isset( $settings[SubmoduleDef::PARAM_SUBMODULE_MAP] ) ) { + $map = $settings[SubmoduleDef::PARAM_SUBMODULE_MAP]; } else { $prefix = $this->isMain() ? '' : ( $this->getModulePath() . '+' ); $map = []; @@ -1889,16 +1889,16 @@ abstract class ApiBase extends ContextSource { self::dieDebug( __METHOD__, 'ApiBase::PARAM_HELP_MSG_PER_VALUE is not valid' ); } - if ( !is_array( $settings[self::PARAM_TYPE] ) ) { + if ( !is_array( $settings[ParamValidator::PARAM_TYPE] ) ) { self::dieDebug( __METHOD__, 'ApiBase::PARAM_HELP_MSG_PER_VALUE may only be used when ' . 'ParamValidator::PARAM_TYPE is an array' ); } $valueMsgs = $settings[self::PARAM_HELP_MSG_PER_VALUE]; - $deprecatedValues = $settings[self::PARAM_DEPRECATED_VALUES] ?? []; + $deprecatedValues = $settings[EnumDef::PARAM_DEPRECATED_VALUES] ?? []; - foreach ( $settings[self::PARAM_TYPE] as $value ) { + foreach ( $settings[ParamValidator::PARAM_TYPE] as $value ) { if ( isset( $valueMsgs[$value] ) ) { $msg = $valueMsgs[$value]; } else { diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 6e0a1d08bdd..d84b2bc553a 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -256,7 +256,7 @@ class ApiBlock extends ApiBase { ], 'userid' => [ ParamValidator::PARAM_TYPE => 'integer', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'expiry' => 'never', 'reason' => '', diff --git a/includes/api/ApiCheckToken.php b/includes/api/ApiCheckToken.php index bb7a3b68296..4a40eac0e6a 100644 --- a/includes/api/ApiCheckToken.php +++ b/includes/api/ApiCheckToken.php @@ -72,7 +72,7 @@ class ApiCheckToken extends ApiBase { 'token' => [ ParamValidator::PARAM_TYPE => 'string', ParamValidator::PARAM_REQUIRED => true, - ApiBase::PARAM_SENSITIVE => true, + ParamValidator::PARAM_SENSITIVE => true, ], 'maxtokenage' => [ ParamValidator::PARAM_TYPE => 'integer', diff --git a/includes/api/ApiComparePages.php b/includes/api/ApiComparePages.php index 0e5c5b2d9e7..19003e82782 100644 --- a/includes/api/ApiComparePages.php +++ b/includes/api/ApiComparePages.php @@ -719,19 +719,19 @@ class ApiComparePages extends ApiBase { 'text' => [ ParamValidator::PARAM_TYPE => 'text', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'contentformat' => [ ParamValidator::PARAM_TYPE => $this->contentHandlerFactory->getAllContentFormats(), - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'contentmodel' => [ ParamValidator::PARAM_TYPE => $this->contentHandlerFactory->getContentModels(), - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'section' => [ ParamValidator::PARAM_DEFAULT => null, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; @@ -776,7 +776,7 @@ class ApiComparePages extends ApiBase { $ret['slots'] = [ ParamValidator::PARAM_TYPE => $slotRoles, ParamValidator::PARAM_ISMULTI => true, - ApiBase::PARAM_ALL => true, + ParamValidator::PARAM_ALL => true, ]; return $ret; diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 38e9fb13552..6dbe3fc35ba 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -286,7 +286,7 @@ class ApiDelete extends ApiBase { 'deletetalk' => false, 'watch' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; @@ -297,7 +297,7 @@ class ApiDelete extends ApiBase { return $params + [ 'unwatch' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'oldimage' => null, ]; diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 61e210a0928..2cbf71eff9c 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -697,11 +697,11 @@ class ApiEditPage extends ApiBase { 'nocreate' => false, 'watch' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'unwatch' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php index 320aaedf141..792c7748b09 100644 --- a/includes/api/ApiExpandTemplates.php +++ b/includes/api/ApiExpandTemplates.php @@ -236,7 +236,7 @@ class ApiExpandTemplates extends ApiBase { 'showstrategykeys' => false, 'generatexml' => [ ParamValidator::PARAM_TYPE => 'boolean', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; } diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index d3c26a30240..0e66d53805e 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -164,7 +164,7 @@ abstract class ApiFormatBase extends ApiBase { return $paramSettings; } - return $paramSettings[self::PARAM_DFLT] ?? null; + return $paramSettings[ParamValidator::PARAM_DEFAULT] ?? null; } /** diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index ae6f3e6e504..50864fd6172 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -502,7 +502,7 @@ class ApiHelp extends ApiBase { } // Add "deprecated" flag - if ( !empty( $settings[ApiBase::PARAM_DEPRECATED] ) ) { + if ( !empty( $settings[ParamValidator::PARAM_DEPRECATED] ) ) { $help['parameters'] .= Html::openElement( 'dd', [ 'class' => 'info' ] ); $help['parameters'] .= self::wrap( diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index 4edb2700048..9607eb5f074 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -284,7 +284,7 @@ class ApiLogin extends ApiBase { 'token' => [ ParamValidator::PARAM_TYPE => 'string', ParamValidator::PARAM_REQUIRED => false, // for BC - ApiBase::PARAM_SENSITIVE => true, + ParamValidator::PARAM_SENSITIVE => true, ApiBase::PARAM_HELP_MSG => [ 'api-help-param-token', 'login' ], ], ]; diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 2d3100b77ee..9220ba1924f 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -303,7 +303,7 @@ class ApiOpenSearch extends ApiBase { 'suggest' => [ ParamValidator::PARAM_DEFAULT => false, // Deprecated since 1.35 - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'redirects' => [ ParamValidator::PARAM_TYPE => [ 'return', 'resolve' ], diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index f09f3b6b8e8..9c2a78d0e44 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -20,6 +20,7 @@ * @file */ +use MediaWiki\Api\Validator\SubmoduleDef; use MediaWiki\Cache\LinkBatchFactory; use MediaWiki\Linker\LinkTarget; use MediaWiki\MainConfigNames; @@ -1646,7 +1647,7 @@ class ApiPageSet extends ApiBase { 'generator' => [ ParamValidator::PARAM_TYPE => null, ApiBase::PARAM_HELP_MSG => 'api-pageset-param-generator', - ApiBase::PARAM_SUBMODULE_PARAM_PREFIX => 'g', + SubmoduleDef::PARAM_SUBMODULE_PARAM_PREFIX => 'g', ], 'redirects' => [ ParamValidator::PARAM_DEFAULT => false, @@ -1667,7 +1668,7 @@ class ApiPageSet extends ApiBase { unset( $result['generator'] ); } elseif ( $flags & ApiBase::GET_VALUES_FOR_HELP ) { $result['generator'][ParamValidator::PARAM_TYPE] = 'submodule'; - $result['generator'][ApiBase::PARAM_SUBMODULE_MAP] = $this->getGenerators(); + $result['generator'][SubmoduleDef::PARAM_SUBMODULE_MAP] = $this->getGenerators(); } return $result; diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php index 2f6839e6712..ff5179fc505 100644 --- a/includes/api/ApiParamInfo.php +++ b/includes/api/ApiParamInfo.php @@ -433,18 +433,18 @@ class ApiParamInfo extends ApiBase { ], 'querymodules' => [ - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ParamValidator::PARAM_ISMULTI => true, ParamValidator::PARAM_TYPE => $querymodules, ], 'mainmodule' => [ - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'pagesetmodule' => [ - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'formatmodules' => [ - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ParamValidator::PARAM_ISMULTI => true, ParamValidator::PARAM_TYPE => $formatmodules, ] diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 299a88aaeed..90e35db5fbf 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -32,6 +32,7 @@ use MediaWiki\Revision\RevisionLookup; use MediaWiki\Revision\RevisionRecord; use MediaWiki\Revision\SlotRecord; use Wikimedia\ParamValidator\ParamValidator; +use Wikimedia\ParamValidator\TypeDef\EnumDef; /** * @ingroup API @@ -1057,7 +1058,7 @@ class ApiParse extends ApiBase { ApiBase::PARAM_HELP_MSG_PER_VALUE => [ 'parsetree' => [ 'apihelp-parse-paramvalue-prop-parsetree', CONTENT_MODEL_WIKITEXT ], ], - ApiBase::PARAM_DEPRECATED_VALUES => [ + EnumDef::PARAM_DEPRECATED_VALUES => [ 'headitems' => 'apiwarn-deprecation-parse-headitems', ], ], @@ -1066,7 +1067,7 @@ class ApiParse extends ApiBase { 'onlypst' => false, 'effectivelanglinks' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'section' => null, 'sectiontitle' => [ @@ -1074,7 +1075,7 @@ class ApiParse extends ApiBase { ], 'disablepp' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'disablelimitreport' => false, 'disableeditsection' => false, @@ -1085,7 +1086,7 @@ class ApiParse extends ApiBase { ApiBase::PARAM_HELP_MSG => [ 'apihelp-parse-param-generatexml', CONTENT_MODEL_WIKITEXT ], - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'preview' => false, 'sectionpreview' => false, diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index c3139079f71..70a848976f5 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -205,7 +205,7 @@ class ApiProtect extends ApiBase { 'cascade' => false, 'watch' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ] + $this->getWatchlistParams(); } diff --git a/includes/api/ApiQueryAllLinks.php b/includes/api/ApiQueryAllLinks.php index 36c2a8ce390..165ef7881f8 100644 --- a/includes/api/ApiQueryAllLinks.php +++ b/includes/api/ApiQueryAllLinks.php @@ -21,6 +21,7 @@ */ use MediaWiki\Linker\LinksMigration; +use MediaWiki\ParamValidator\TypeDef\NamespaceDef; use Wikimedia\ParamValidator\ParamValidator; use Wikimedia\ParamValidator\TypeDef\IntegerDef; @@ -312,7 +313,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase { 'namespace' => [ ParamValidator::PARAM_DEFAULT => $this->dfltNamespace, ParamValidator::PARAM_TYPE => 'namespace', - ApiBase::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], + NamespaceDef::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], ], 'limit' => [ ParamValidator::PARAM_DEFAULT => 10, diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index 27e22dcb440..4509c166348 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -385,10 +385,10 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { 'startsortkeyprefix' => null, 'endsortkeyprefix' => null, 'startsortkey' => [ - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'endsortkey' => [ - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; diff --git a/includes/api/ApiQueryIWLinks.php b/includes/api/ApiQueryIWLinks.php index f927115b9b2..12e60ea212a 100644 --- a/includes/api/ApiQueryIWLinks.php +++ b/includes/api/ApiQueryIWLinks.php @@ -183,7 +183,7 @@ class ApiQueryIWLinks extends ApiQueryBase { ], 'url' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; } diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index dd466984237..ecccbaa55fa 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -28,6 +28,7 @@ use MediaWiki\ParamValidator\TypeDef\TitleDef; use MediaWiki\Permissions\PermissionStatus; use MediaWiki\Permissions\RestrictionStore; use Wikimedia\ParamValidator\ParamValidator; +use Wikimedia\ParamValidator\TypeDef\EnumDef; /** * A query module to show basic page information. @@ -860,7 +861,7 @@ class ApiQueryInfo extends ApiQueryBase { // need to be added to getCacheMode() ], ApiBase::PARAM_HELP_MSG_PER_VALUE => [], - ApiBase::PARAM_DEPRECATED_VALUES => [ + EnumDef::PARAM_DEPRECATED_VALUES => [ 'readable' => true, // Since 1.32 ], ], diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index a6ed1ea5ded..6db5ef126d5 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -198,7 +198,7 @@ class ApiQueryLangLinks extends ApiQueryBase { ], 'url' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; } diff --git a/includes/api/ApiQueryLanguageinfo.php b/includes/api/ApiQueryLanguageinfo.php index cc6d1f3e55c..7bedc25f8b1 100644 --- a/includes/api/ApiQueryLanguageinfo.php +++ b/includes/api/ApiQueryLanguageinfo.php @@ -22,6 +22,7 @@ use MediaWiki\Languages\LanguageConverterFactory; use MediaWiki\Languages\LanguageFactory; use MediaWiki\Languages\LanguageFallback; use MediaWiki\Languages\LanguageNameUtils; +use Wikimedia\ParamValidator\ParamValidator; use Wikimedia\Timestamp\ConvertibleTimestamp; /** @@ -216,9 +217,9 @@ class ApiQueryLanguageinfo extends ApiQueryBase { public function getAllowedParams() { return [ 'prop' => [ - self::PARAM_DFLT => 'code', - self::PARAM_ISMULTI => true, - self::PARAM_TYPE => [ + ParamValidator::PARAM_DEFAULT => 'code', + ParamValidator::PARAM_ISMULTI => true, + ParamValidator::PARAM_TYPE => [ 'code', 'bcp47', 'dir', @@ -230,8 +231,8 @@ class ApiQueryLanguageinfo extends ApiQueryBase { self::PARAM_HELP_MSG_PER_VALUE => [], ], 'code' => [ - self::PARAM_DFLT => '*', - self::PARAM_ISMULTI => true, + ParamValidator::PARAM_DEFAULT => '*', + ParamValidator::PARAM_ISMULTI => true, ], 'continue' => [ self::PARAM_HELP_MSG => 'api-help-param-continue', diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 82305018d54..311c3358b26 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -22,6 +22,7 @@ use MediaWiki\Cache\LinkBatchFactory; use MediaWiki\Linker\LinksMigration; +use MediaWiki\ParamValidator\TypeDef\NamespaceDef; use Wikimedia\ParamValidator\ParamValidator; use Wikimedia\ParamValidator\TypeDef\IntegerDef; @@ -230,7 +231,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { 'namespace' => [ ParamValidator::PARAM_TYPE => 'namespace', ParamValidator::PARAM_ISMULTI => true, - ApiBase::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], + NamespaceDef::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], ], 'limit' => [ ParamValidator::PARAM_DEFAULT => 10, diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 38f14d0623a..777d87970a3 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -23,6 +23,7 @@ use MediaWiki\CommentFormatter\CommentFormatter; use MediaWiki\CommentFormatter\RowCommentFormatter; use MediaWiki\MainConfigNames; +use MediaWiki\ParamValidator\TypeDef\NamespaceDef; use MediaWiki\ParamValidator\TypeDef\UserDef; use MediaWiki\Storage\NameTableAccessException; use MediaWiki\Storage\NameTableStore; @@ -488,7 +489,7 @@ class ApiQueryLogEvents extends ApiQueryBase { 'title' => null, 'namespace' => [ ParamValidator::PARAM_TYPE => 'namespace', - ApiBase::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], + NamespaceDef::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], ], 'prefix' => [], 'tag' => null, diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index e1948ff0ecc..aeace8836e0 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -201,7 +201,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase { ParamValidator::PARAM_DEFAULT => 'nonredirects', // for BC ], 'redirect' => [ - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ParamValidator::PARAM_DEFAULT => false, ], 'limit' => [ diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 054c6029137..44ab6551ba6 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -22,6 +22,7 @@ use MediaWiki\CommentFormatter\RowCommentFormatter; use MediaWiki\MainConfigNames; +use MediaWiki\ParamValidator\TypeDef\NamespaceDef; use MediaWiki\ParamValidator\TypeDef\UserDef; use MediaWiki\Revision\RevisionRecord; use MediaWiki\Revision\SlotRoleRegistry; @@ -704,7 +705,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { 'namespace' => [ ParamValidator::PARAM_ISMULTI => true, ParamValidator::PARAM_TYPE => 'namespace', - ApiBase::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], + NamespaceDef::PARAM_EXTRA_NAMESPACES => [ NS_MEDIA, NS_SPECIAL ], ], 'user' => [ ParamValidator::PARAM_TYPE => 'user', diff --git a/includes/api/ApiQueryRevisionsBase.php b/includes/api/ApiQueryRevisionsBase.php index a9fe9daeae4..0f032e073a9 100644 --- a/includes/api/ApiQueryRevisionsBase.php +++ b/includes/api/ApiQueryRevisionsBase.php @@ -32,6 +32,7 @@ use MediaWiki\Revision\RevisionStore; use MediaWiki\Revision\SlotRecord; use MediaWiki\Revision\SlotRoleRegistry; use Wikimedia\ParamValidator\ParamValidator; +use Wikimedia\ParamValidator\TypeDef\EnumDef; use Wikimedia\ParamValidator\TypeDef\IntegerDef; /** @@ -779,7 +780,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase { 'parsetree' => [ 'apihelp-query+revisions+base-paramvalue-prop-parsetree', CONTENT_MODEL_WIKITEXT ], ], - ApiBase::PARAM_DEPRECATED_VALUES => [ + EnumDef::PARAM_DEPRECATED_VALUES => [ 'parsetree' => true, ], ], @@ -787,7 +788,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase { ParamValidator::PARAM_TYPE => $slotRoles, ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-slots', ParamValidator::PARAM_ISMULTI => true, - ApiBase::PARAM_ALL => true, + ParamValidator::PARAM_ALL => true, ], 'limit' => [ ParamValidator::PARAM_TYPE => 'limit', @@ -799,38 +800,38 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase { 'expandtemplates' => [ ParamValidator::PARAM_DEFAULT => false, ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-expandtemplates', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'generatexml' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-generatexml', ], 'parse' => [ ParamValidator::PARAM_DEFAULT => false, ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-parse', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'section' => [ ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-section', ], 'diffto' => [ ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-diffto', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'difftotext' => [ ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-difftotext', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'difftotextpst' => [ ParamValidator::PARAM_DEFAULT => false, ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-difftotextpst', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'contentformat' => [ ParamValidator::PARAM_TYPE => $this->contentHandlerFactory->getAllContentFormats(), ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-contentformat', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; } diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 4f1a3e5d268..3d0b55b8905 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -21,6 +21,7 @@ */ use Wikimedia\ParamValidator\ParamValidator; +use Wikimedia\ParamValidator\TypeDef\EnumDef; /** * Query module to perform full text search within wiki titles and content @@ -422,7 +423,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { ], ParamValidator::PARAM_ISMULTI => true, ApiBase::PARAM_HELP_MSG_PER_VALUE => [], - ApiBase::PARAM_DEPRECATED_VALUES => [ + EnumDef::PARAM_DEPRECATED_VALUES => [ 'score' => true, 'hasrelated' => true ], diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index 2ab0d72f6c9..02c73ff7406 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -135,7 +135,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { ], 'sessionkey' => [ ParamValidator::PARAM_ISMULTI => true, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'prop' => [ ParamValidator::PARAM_ISMULTI => true, diff --git a/includes/api/ApiQueryTokens.php b/includes/api/ApiQueryTokens.php index 08bed5cb491..5fa7a9fb297 100644 --- a/includes/api/ApiQueryTokens.php +++ b/includes/api/ApiQueryTokens.php @@ -121,7 +121,7 @@ class ApiQueryTokens extends ApiQueryBase { ParamValidator::PARAM_DEFAULT => 'csrf', ParamValidator::PARAM_ISMULTI => true, ParamValidator::PARAM_TYPE => array_keys( self::getTokenTypeSalts() ), - ApiBase::PARAM_ALL => true, + ParamValidator::PARAM_ALL => true, ], ]; } diff --git a/includes/api/ApiQueryUserContribs.php b/includes/api/ApiQueryUserContribs.php index 4927108fe56..346fd5de594 100644 --- a/includes/api/ApiQueryUserContribs.php +++ b/includes/api/ApiQueryUserContribs.php @@ -748,7 +748,7 @@ class ApiQueryUserContribs extends ApiQueryBase { 'tag' => null, 'toponly' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; } diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 35423ae9885..6c6ca412b47 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -355,7 +355,7 @@ class ApiQueryUserInfo extends ApiQueryBase { return [ 'prop' => [ ParamValidator::PARAM_ISMULTI => true, - ApiBase::PARAM_ALL => true, + ParamValidator::PARAM_ALL => true, ParamValidator::PARAM_TYPE => [ 'blockinfo', 'hasmsg', diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index e37b6b21200..8248093bc4e 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -564,7 +564,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { ], 'token' => [ ParamValidator::PARAM_TYPE => 'string', - ApiBase::PARAM_SENSITIVE => true, + ParamValidator::PARAM_SENSITIVE => true, ], 'continue' => [ ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', diff --git a/includes/api/ApiQueryWatchlistRaw.php b/includes/api/ApiQueryWatchlistRaw.php index 9c2bdc07c92..4f5da9a27ff 100644 --- a/includes/api/ApiQueryWatchlistRaw.php +++ b/includes/api/ApiQueryWatchlistRaw.php @@ -216,7 +216,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase { ], 'token' => [ ParamValidator::PARAM_TYPE => 'string', - ApiBase::PARAM_SENSITIVE => true, + ParamValidator::PARAM_SENSITIVE => true, ], 'dir' => [ ParamValidator::PARAM_DEFAULT => 'ascending', diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php index b47f8de40ac..dd387bc17ff 100644 --- a/includes/api/ApiUnblock.php +++ b/includes/api/ApiUnblock.php @@ -140,7 +140,7 @@ class ApiUnblock extends ApiBase { ], 'userid' => [ ParamValidator::PARAM_TYPE => 'integer', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'reason' => '', 'tags' => [ diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 19e1a6dd001..4c048eb3c11 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -959,7 +959,7 @@ class ApiUpload extends ApiBase { ], 'watch' => [ ParamValidator::PARAM_DEFAULT => false, - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], ]; @@ -979,7 +979,7 @@ class ApiUpload extends ApiBase { 'url' => null, 'filekey' => null, 'sessionkey' => [ - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'stash' => false, diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php index 7831ff45219..b6f1d12bceb 100644 --- a/includes/api/ApiUserrights.php +++ b/includes/api/ApiUserrights.php @@ -180,7 +180,7 @@ class ApiUserrights extends ApiBase { ], 'userid' => [ ParamValidator::PARAM_TYPE => 'integer', - ApiBase::PARAM_DEPRECATED => true, + ParamValidator::PARAM_DEPRECATED => true, ], 'add' => [ ParamValidator::PARAM_TYPE => $allGroups,