MediaWiki REL1_28
ApiBase Class Reference

This abstract class implements many basic API functions, and is the base of all API classes. More...

Inherits ContextSource.

Inherited by ApiAMCreateAccount, ApiBlock, ApiCSPReport, ApiChangeAuthenticationData, ApiCheckToken, ApiClearHasMsg, ApiClientLogin, ApiComparePages, ApiDelete, ApiDisabled, ApiEditPage, ApiEmailUser, ApiExpandTemplates, ApiFeedContributions, ApiFeedRecentChanges, ApiFeedWatchlist, ApiFileRevert, ApiFormatBase, ApiHelp, ApiImageRotate, ApiImport, ApiLinkAccount, ApiLogin, ApiLogout, ApiMain, ApiManageTags, ApiMergeHistory, ApiMove, ApiOpenSearch, ApiOptions, ApiPageSet, ApiParamInfo, ApiParse, ApiPatrol, ApiProtect, ApiPurge, ApiQuery, ApiQueryBase, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiRsd, ApiSetNotificationTimestamp, ApiStashEdit, ApiTag, ApiTokens, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, ApiWatch, and MockApi.

Collaboration diagram for ApiBase:

Public Member Functions

 __construct (ApiMain $mainModule, $moduleName, $modulePrefix='')
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getConfig ()
 Get the Config object.
 
 getContext ()
 Get the base IContextSource object.
 
 getLanguage ()
 Get the Language object.
 
 getOutput ()
 Get the OutputPage object.
 
 getRequest ()
 Get the WebRequest object.
 
 getSkin ()
 Get the Skin object.
 
 getStats ()
 Get the Stats object.
 
 getTiming ()
 Get the Timing object.
 
 getTitle ()
 Get the Title object.
 
 getUser ()
 Get the User object.
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ()
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 Set the IContextSource object.
 

Public Attributes

const GET_VALUES_FOR_HELP = 1
 getAllowedParams() flag: When set, the result could take longer to generate, but should be more thorough.
 
const LIMIT_BIG1 = 500
 Fast query, standard limit.
 
const LIMIT_BIG2 = 5000
 Fast query, apihighlimits limit.
 
const LIMIT_SML1 = 50
 Slow query, standard limit.
 
const LIMIT_SML2 = 500
 Slow query, apihighlimits limit.
 
Constants for ::getAllowedParams() arrays

These constants are keys in the arrays returned by getAllowedParams() and accepted by getParameterFromSettings() that define how the parameters coming in from the request are to be interpreted.

const PARAM_DFLT = 0
 (null|boolean|integer|string) Default value of the parameter.
 
const PARAM_ISMULTI = 1
 (boolean) Accept multiple pipe-separated values for this parameter (e.g.
 
const PARAM_TYPE = 2
 (string|string[]) Either an array of allowed value strings, or a string type as described below.
 
const PARAM_MAX = 3
 (integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
 
const PARAM_MAX2 = 4
 (integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'.
 
const PARAM_MIN = 5
 (integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
 
const PARAM_ALLOW_DUPLICATES = 6
 (boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true?
 
const PARAM_DEPRECATED = 7
 (boolean) Is the parameter deprecated (will show a warning)?
 
const PARAM_REQUIRED = 8
 (boolean) Is the parameter required?
 
const PARAM_RANGE_ENFORCE = 9
 (boolean) For PARAM_TYPE 'integer', enforce PARAM_MIN and PARAM_MAX?
 
const PARAM_HELP_MSG = 10
 (string|array|Message) Specify an alternative i18n documentation message for this parameter.
 
const PARAM_HELP_MSG_APPEND = 11
 ((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this parameter.
 
const PARAM_HELP_MSG_INFO = 12
 (array) Specify additional information tags for the parameter.
 
const PARAM_VALUE_LINKS = 13
 (string[]) When PARAM_TYPE is an array, this may be an array mapping those values to page titles which will be linked in the help.
 
const PARAM_HELP_MSG_PER_VALUE = 14
 ((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg for ApiBase::makeMessage().
 
const PARAM_SUBMODULE_MAP = 15
 (string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths.
 
const PARAM_SUBMODULE_PARAM_PREFIX = 16
 (string) When PARAM_TYPE is 'submodule', used to indicate the 'g' prefix added by ApiQueryGeneratorBase (and similar if anything else ever does that).
 
const PARAM_SENSITIVE = 17
 (boolean) Is the parameter sensitive? Note 'password'-type fields are always sensitive regardless of the value of this field.
 

Private Attributes

ApiMain $mMainModule
 
string $mModuleName
 
string $mModulePrefix
 
array null bool $mModuleSource = false
 
 $mParamCache = []
 
 $mSlaveDB = null
 

Static Private Attributes

static array $extensionInfo = null
 Maps extension paths to info arrays.
 

Warning and error reporting

static $messageMap
 Array that maps message keys to error messages.
 
 setWarning ( $warning)
 Set warning section for this module.
 
 dieUsage ( $description, $errorCode, $httpRespCode=0, $extradata=null)
 Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an error message.
 
 dieBlocked (Block $block)
 Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an error message including block info.
 
 getErrorFromStatus ( $status, &$extraData=null)
 Get error (as code, string) from a Status object.
 
 dieStatus ( $status)
 Throw a UsageException based on the errors in the Status object.
 
 dieReadOnly ()
 Helper function for readonly errors.
 
 dieUsageMsg ( $error)
 Output the error message related to a certain array.
 
 dieUsageMsgOrDebug ( $error)
 Will only set a warning instead of failing if the global $wgDebugAPI is set to true.
 
 parseMsg ( $error)
 Return the error message related to a certain array.
 
 logFeatureUsage ( $feature)
 Write logging information for API features to a debug log, for usage analysis.
 
 dieContinueUsageIf ( $condition)
 Die with the $prefix.
 
 warnOrDie ( $msg, $enforceLimits=false)
 Adds a warning to the output, else dies.
 
static dieDebug ( $method, $message)
 Internal code errors should be reported with this method.
 

Methods to implement

 execute ()
 Evaluates the parameters, performs the requested query, and sets up the result.
 
 getModuleManager ()
 Get the module manager, or null if this module has no sub-modules.
 
 getCustomPrinter ()
 If the module may only be used with a certain format module, it should override this method to return an instance of that formatter.
 
 getHelpUrls ()
 Return links to more detailed help pages about the module.
 
 shouldCheckMaxlag ()
 Indicates if this module needs maxlag to be checked.
 
 isReadMode ()
 Indicates whether this module requires read rights.
 
 isWriteMode ()
 Indicates whether this module requires write mode.
 
 mustBePosted ()
 Indicates whether this module must be called with a POST request.
 
 isDeprecated ()
 Indicates whether this module is deprecated.
 
 isInternal ()
 Indicates whether this module is "internal" Internal API modules are not (yet) intended for 3rd party use and may be unstable.
 
 needsToken ()
 Returns the token type this module requires in order to execute.
 
 getConditionalRequestData ( $condition)
 Returns data for HTTP conditional request mechanisms.
 
 getExamplesMessages ()
 Returns usage examples for this module.
 
 getAllowedParams ()
 Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (array with PARAM_* constants as keys) Don't call this function directly: use getFinalParams() to allow hooks to modify parameters as needed.
 
 getWebUITokenSalt (array $params)
 Fetch the salt used in the Web UI corresponding to this module.
 

Data access methods

 getModuleName ()
 Get the name of the module being executed by this instance.
 
 getModulePrefix ()
 Get parameter prefix (usually two letters or an empty string).
 
 getMain ()
 Get the main module.
 
 isMain ()
 Returns true if this module is the main module ($this === $this->mMainModule), false otherwise.
 
 getParent ()
 Get the parent of this module.
 
 lacksSameOriginSecurity ()
 Returns true if the current request breaks the same-origin policy.
 
 getModulePath ()
 Get the path to this module.
 
 getModuleFromPath ( $path)
 Get a module from its module path.
 
 getResult ()
 Get the result object.
 
 getErrorFormatter ()
 Get the error formatter.
 
 getContinuationManager ()
 Get the continuation manager.
 
 setContinuationManager ( $manager)
 Set the continuation manager.
 
 getDB ()
 Gets a default replica DB connection object.
 

Parameter handling

 dynamicParameterDocumentation ()
 Indicate if the module supports dynamically-determined parameters that cannot be included in self::getAllowedParams().
 
 encodeParamName ( $paramName)
 This method mangles parameter name based on the prefix supplied to the constructor.
 
 extractRequestParams ( $parseLimit=true)
 Using getAllowedParams(), this function makes an array of the values provided by the user, with key being the name of the variable, and value - validated value from user or default.
 
 requireOnlyOneParameter ( $params, $required)
 Die if none or more than one of a certain set of parameters is set and not false.
 
 requireMaxOneParameter ( $params, $required)
 Die if more than one of a certain set of parameters is set and not false.
 
 requireAtLeastOneParameter ( $params, $required)
 Die if none of a certain set of parameters is set and not false.
 
 requirePostedParameters ( $params, $prefix='prefix')
 Die if any of the specified parameters were found in the query part of the URL rather than the post body.
 
 getTitleOrPageId ( $params, $load=false)
 Get a WikiPage object from a title or pageid param, if possible.
 
 validateToken ( $token, array $params)
 Validate the supplied token.
 
 getParameter ( $paramName, $parseLimit=true)
 Get a value for the given parameter.
 
 getWatchlistValue ( $watchlist, $titleObj, $userOption=null)
 Return true if we're to watch the page, false if not, null if no change.
 
 getParameterFromSettings ( $paramName, $paramSettings, $parseLimit)
 Using the settings determine the value for the given parameter.
 
 handleParamNormalization ( $paramName, $value, $rawValue)
 Handle when a parameter was Unicode-normalized.
 
 explodeMultiValue ( $value, $limit)
 Split a multi-valued parameter string, like explode()
 
 parseMultiValue ( $valueName, $value, $allowMultiple, $allowedValues)
 Return an array of values that were given in a 'a|b|c' notation, after it optionally validates them against the list allowed values.
 
 validateLimit ( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
 Validate the value against the minimum and user/bot maximum limits.
 
 validateTimestamp ( $value, $encParamName)
 Validate and normalize of parameters of type 'timestamp'.
 
 parameterNotEmpty ( $x)
 Callback function used in requireOnlyOneParameter to check whether required parameters are set.
 
 validateUser ( $value, $encParamName)
 Validate and normalize of parameters of type 'user'.
 

Utility methods

 getWatchlistUser ( $params)
 Gets the user for whom to get the watchlist.
 
 setWatch ( $watch, $titleObj, $userOption=null)
 Set a watch (or unwatch) based the based on a watchlist parameter.
 
static truncateArray (&$arr, $limit)
 Truncate an array to a certain length.
 
static makeMessage ( $msg, IContextSource $context, array $params=null)
 Create a Message from a string or array.
 
static escapeWikiText ( $v)
 A subset of wfEscapeWikiText for BC texts.
 

Help message generation

 getFinalDescription ()
 Get final module description, after hooks have had a chance to tweak it as needed.
 
 getFinalParams ( $flags=0)
 Get final list of parameters, after hooks have had a chance to tweak it as needed.
 
 getFinalParamDescription ()
 Get final parameter descriptions, after hooks have had a chance to tweak it as needed.
 
 modifyHelp (array &$help, array $options, array &$tocData)
 Called from ApiHelp before the pieces are joined together and returned.
 
 getDescriptionMessage ()
 Return the description message.
 
 getHelpFlags ()
 Generates the list of flags for the help screen and for action=paraminfo.
 
 getModuleSourceInfo ()
 Returns information about the source of this module, if known.
 

Deprecated

 getModuleProfileName ( $db=false)
 
 profileIn ()
 
 profileOut ()
 
 safeProfileOut ()
 
 getProfileTime ()
 
 profileDBIn ()
 
 profileDBOut ()
 
 getProfileDBTime ()
 
 getDescription ()
 Returns the description string for this module.
 
 getParamDescription ()
 Returns an array of parameter descriptions.
 
 getExamples ()
 Returns usage examples for this module.
 
 useTransactionalTimeLimit ()
 Call wfTransactionalTimeLimit() if this request was POSTed.
 

Detailed Description

This abstract class implements many basic API functions, and is the base of all API classes.

The class functions are divided into several areas of functionality:

Module parameters: Derived classes can define getAllowedParams() to specify which parameters to expect, how to parse and validate them.

Self-documentation: code to allow the API to document its own state

Definition at line 39 of file ApiBase.php.

Constructor & Destructor Documentation

◆ __construct()

ApiBase::__construct ( ApiMain  $mainModule,
  $moduleName,
  $modulePrefix = '' 
)
Parameters
ApiMain$mainModule
string$moduleNameName of this module
string$modulePrefixPrefix to use for parameter names

Reimplemented in ApiOpenSearchFormatJson.

Definition at line 216 of file ApiBase.php.

References ContextSource\getContext(), isMain(), and ContextSource\setContext().

Member Function Documentation

◆ dieBlocked()

ApiBase::dieBlocked ( Block  $block)

Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an error message including block info.

Since
1.27
Parameters
Block$blockThe block used to generate the UsageException
Exceptions
UsageExceptionalways

Definition at line 1602 of file ApiBase.php.

References dieUsage(), ApiQueryUserInfo\getBlockInfo(), Block\getType(), and Block\TYPE_AUTO.

Referenced by ApiUpload\checkPermissions(), ApiRevisionDelete\execute(), ApiTag\execute(), ApiUndelete\execute(), and ApiUserrights\execute().

◆ dieContinueUsageIf()

◆ dieDebug()

◆ dieReadOnly()

ApiBase::dieReadOnly ( )

Helper function for readonly errors.

Exceptions
UsageExceptionalways

Definition at line 2192 of file ApiBase.php.

References dieUsage(), parseMsg(), and wfReadOnlyReason().

Referenced by ApiMain\checkReadOnly(), and ApiEditPage\execute().

◆ dieStatus()

◆ dieUsage()

ApiBase::dieUsage (   $description,
  $errorCode,
  $httpRespCode = 0,
  $extradata = null 
)

Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an error message.

Parameters
string$descriptionOne-line human-readable description of the error condition, e.g., "The API requires a valid action parameter"
string$errorCodeBrief, arbitrary, stable string to allow easy automated identification of the error, e.g., 'unknown_action'
int$httpRespCodeHTTP response code
array | null$extradataData to add to the "<error>" element; array in ApiResult format
Exceptions
UsageExceptionalways

Definition at line 1585 of file ApiBase.php.

References encodeParamName().

Referenced by ApiQuerySiteinfo\appendDbReplLagInfo(), ApiMain\checkAsserts(), ApiMain\checkBotReadOnly(), ApiMain\checkExecutePermissions(), ApiMain\checkMaxLag(), ApiQueryImageInfo\checkParameterNormalise(), ApiParse\checkReadPermissions(), ApiUpload\checkVerification(), ApiMain\createPrinterByName(), dieBlocked(), dieContinueUsageIf(), dieReadOnly(), ApiUpload\dieRecoverableError(), dieStatus(), ApiUpload\dieStatusWithCode(), dieUsageMsg(), ApiCSPReport\error(), ApiAMCreateAccount\execute(), ApiBlock\execute(), ApiChangeAuthenticationData\execute(), ApiClientLogin\execute(), ApiComparePages\execute(), ApiDisabled\execute(), ApiEditPage\execute(), ApiExpandTemplates\execute(), ApiFeedContributions\execute(), ApiFeedRecentChanges\execute(), ApiFeedWatchlist\execute(), ApiFormatJson\execute(), ApiFormatPhp\execute(), ApiLinkAccount\execute(), ApiLogout\execute(), ApiManageTags\execute(), ApiOpenSearchFormatJson\execute(), ApiOptions\execute(), ApiParse\execute(), ApiPatrol\execute(), ApiQueryAllMessages\execute(), ApiQueryAllUsers\execute(), ApiQueryBlocks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryLogEvents\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryStashImageInfo\execute(), ApiQueryContributions\execute(), ApiRemoveAuthenticationData\execute(), ApiResetPassword\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiSetNotificationTimestamp\execute(), ApiStashEdit\execute(), ApiTag\execute(), ApiUnblock\execute(), ApiUpload\execute(), ApiWatch\execute(), ApiQueryAllImages\executeGenerator(), ApiQueryAllPages\executeGenerator(), ApiPageSet\executeInternal(), ApiQueryRevisionsBase\extractRevisionInfo(), ApiUpload\getChunkResult(), getModuleFromPath(), getParameterFromSettings(), ApiParse\getParsedContent(), ApiParse\getSectionContent(), getTitleOrPageId(), getWatchlistUser(), ApiQueryImageInfo\mergeThumbParams(), ApiQuery\outputGeneralPageInfo(), parseMultiValue(), ApiQueryRevisionsBase\parseParameters(), ApiUpload\performUpload(), ApiQueryContributions\prepareQuery(), ApiQueryBase\prepareUrlQuerySearchString(), ApiQueryBlocks\prepareUsername(), requireAtLeastOneParameter(), requireMaxOneParameter(), requireOnlyOneParameter(), requirePostedParameters(), ApiComparePages\revisionOrTitleOrId(), ApiQueryAllImages\run(), ApiQueryAllLinks\run(), ApiQueryAllPages\run(), ApiQueryCategoryMembers\run(), ApiQueryRecentChanges\run(), ApiQuerySearch\run(), ApiQueryWatchlist\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryDeletedRevisions\run(), ApiQueryRevisions\run(), ApiUpload\selectUploadModule(), ApiMain\setupExecuteAction(), ApiMain\setupModule(), validateTimestamp(), validateUser(), and warnOrDie().

◆ dieUsageMsg()

ApiBase::dieUsageMsg (   $error)

Output the error message related to a certain array.

Parameters
array | string | MessageSpecifier$errorElement of a getUserPermissionsErrors()-style array
Exceptions
UsageExceptionalways

Definition at line 2203 of file ApiBase.php.

References dieUsage(), and parseMsg().

Referenced by ApiMain\checkExecutePermissions(), ApiFileRevert\checkPermissions(), ApiUpload\checkPermissions(), dieUsageMsgOrDebug(), ApiBlock\execute(), ApiDelete\execute(), ApiEditPage\execute(), ApiEmailUser\execute(), ApiExpandTemplates\execute(), ApiImport\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiOptions\execute(), ApiParse\execute(), ApiPatrol\execute(), ApiProtect\execute(), ApiQueryAllMessages\execute(), ApiQueryBlocks\execute(), ApiQueryIWLinks\execute(), ApiQueryLangLinks\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiWatch\execute(), ApiUpload\getContextResult(), ApiFeedRecentChanges\getFeedObject(), getParameterFromSettings(), ApiRollback\getRbTitle(), ApiRollback\getRbUser(), getTitleOrPageId(), ApiQueryRevisionsBase\parseParameters(), ApiQueryBase\prefixedTitlePartToKey(), ApiQueryContributions\prepareQuery(), ApiComparePages\revisionOrTitleOrId(), ApiQueryCategories\run(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryQueryPage\run(), ApiQueryRecentChanges\run(), ApiQueryWatchlist\run(), ApiQueryWatchlistRaw\run(), ApiQueryBacklinksprop\run(), ApiUpload\selectUploadModule(), ApiMain\setupModule(), ApiQueryBase\titlePartToKey(), and ApiFileRevert\validateParameters().

◆ dieUsageMsgOrDebug()

ApiBase::dieUsageMsgOrDebug (   $error)

Will only set a warning instead of failing if the global $wgDebugAPI is set to true.

Otherwise behaves exactly as dieUsageMsg().

Parameters
array | string | MessageSpecifier$errorElement of a getUserPermissionsErrors()-style array
Exceptions
UsageException
Since
1.21

Definition at line 2221 of file ApiBase.php.

References dieUsageMsg(), ContextSource\getConfig(), parseMsg(), and setWarning().

Referenced by ApiQuery\instantiateModules(), and ApiMain\setupExternalResponse().

◆ dynamicParameterDocumentation()

ApiBase::dynamicParameterDocumentation ( )

Indicate if the module supports dynamically-determined parameters that cannot be included in self::getAllowedParams().

Returns
string|array|Message|null Return null if the module does not support additional dynamic parameters, otherwise return a message describing them.

Reimplemented in ApiAMCreateAccount, ApiChangeAuthenticationData, ApiClientLogin, and ApiLinkAccount.

Definition at line 662 of file ApiBase.php.

◆ encodeParamName()

ApiBase::encodeParamName (   $paramName)

This method mangles parameter name based on the prefix supplied to the constructor.

Override this method to change parameter name during runtime

Parameters
string$paramNameParameter name
Returns
string Prefixed parameter name

Reimplemented in ApiQueryGeneratorBase.

Definition at line 672 of file ApiBase.php.

Referenced by ApiContinuationManager\addContinueParam(), ApiContinuationManager\addGeneratorContinueParam(), ApiContinuationManager\addGeneratorNonContinueParam(), dieUsage(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiLinkAccount\execute(), ApiQueryLogEvents\execute(), getParameterFromSettings(), handleParamNormalization(), requirePostedParameters(), and validateLimit().

◆ escapeWikiText()

static ApiBase::escapeWikiText (   $v)
staticprivate

A subset of wfEscapeWikiText for BC texts.

Since
1.25
Parameters
string | array$v
Returns
string|array

Definition at line 1498 of file ApiBase.php.

Referenced by getExamplesMessages(), getFinalDescription(), and getFinalParamDescription().

◆ execute()

ApiBase::execute ( )
abstract

Evaluates the parameters, performs the requested query, and sets up the result.

Concrete implementations of ApiBase must override this method to provide whatever functionality their module offers. Implementations must not produce any output on their own and are not expected to handle any errors.

The execute() method will be invoked directly by ApiMain immediately before the result of the module is output. Aside from the constructor, implementations should assume that no other methods will be called externally on the module before the result is processed.

The result data should be stored in the ApiResult object available through getResult().

Reimplemented in ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiCheckToken, ApiClearHasMsg, ApiClientLogin, ApiComparePages, ApiCSPReport, ApiDelete, ApiDisabled, ApiEditPage, ApiEmailUser, ApiExpandTemplates, ApiFeedContributions, ApiFeedRecentChanges, ApiFeedWatchlist, ApiFileRevert, ApiFormatFeedWrapper, ApiFormatJson, ApiFormatNone, ApiFormatPhp, ApiFormatRaw, ApiFormatXml, ApiHelp, ApiImageRotate, ApiImport, ApiLinkAccount, ApiLogin, ApiLogout, ApiMain, ApiManageTags, ApiMergeHistory, ApiMove, ApiOpenSearch, ApiOpenSearchFormatJson, ApiOptions, ApiPageSet, ApiParamInfo, ApiParse, ApiPatrol, ApiProtect, ApiPurge, ApiQuery, ApiQueryAllCategories, ApiQueryAllImages, ApiQueryAllLinks, ApiQueryAllMessages, ApiQueryAllPages, ApiQueryAllUsers, ApiQueryAuthManagerInfo, ApiQueryBacklinks, ApiQueryBacklinksprop, ApiQueryBlocks, ApiQueryCategories, ApiQueryCategoryInfo, ApiQueryCategoryMembers, ApiQueryContributors, ApiQueryDeletedrevs, ApiQueryDisabled, ApiQueryDuplicateFiles, ApiQueryExternalLinks, ApiQueryExtLinksUsage, ApiQueryFilearchive, ApiQueryFileRepoInfo, ApiQueryImageInfo, ApiQueryImages, ApiQueryInfo, ApiQueryIWBacklinks, ApiQueryIWLinks, ApiQueryLangBacklinks, ApiQueryLangLinks, ApiQueryLinks, ApiQueryLogEvents, ApiQueryMyStashedFiles, ApiQueryPagePropNames, ApiQueryPageProps, ApiQueryPagesWithProp, ApiQueryPrefixSearch, ApiQueryProtectedTitles, ApiQueryQueryPage, ApiQueryRandom, ApiQueryRecentChanges, ApiQueryRevisionsBase, ApiQuerySearch, ApiQuerySiteinfo, ApiQueryStashImageInfo, ApiQueryTags, ApiQueryTokens, ApiQueryContributions, ApiQueryUserInfo, ApiQueryUsers, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiRsd, ApiSetNotificationTimestamp, ApiStashEdit, ApiTag, ApiTokens, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, ApiWatch, MockApi, and MockApiQueryBase.

◆ explodeMultiValue()

ApiBase::explodeMultiValue (   $value,
  $limit 
)
protected

Split a multi-valued parameter string, like explode()

Since
1.28
Parameters
string$value
int$limit
Returns
string[]

Definition at line 1207 of file ApiBase.php.

References $limit, and $value.

Referenced by ApiPageSet\handleParamNormalization(), and parseMultiValue().

◆ extractRequestParams()

ApiBase::extractRequestParams (   $parseLimit = true)

Using getAllowedParams(), this function makes an array of the values provided by the user, with key being the name of the variable, and value - validated value from user or default.

limits will not be parsed if $parseLimit is set to false; use this when the max limit is not definitive yet, e.g. when getting revisions.

Parameters
bool$parseLimitTrue by default
Returns
array

Definition at line 685 of file ApiBase.php.

References $params, as, getFinalParams(), and getParameterFromSettings().

Referenced by ApiPageSet\__construct(), ApiAuthManagerHelper\__construct(), ApiContinuationManager\__construct(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiAMCreateAccount\execute(), ApiBlock\execute(), ApiCheckToken\execute(), ApiClientLogin\execute(), ApiComparePages\execute(), ApiDelete\execute(), ApiEditPage\execute(), ApiEmailUser\execute(), ApiExpandTemplates\execute(), ApiFeedContributions\execute(), ApiFeedRecentChanges\execute(), ApiFeedWatchlist\execute(), ApiFileRevert\execute(), ApiFormatJson\execute(), ApiFormatPhp\execute(), ApiFormatXml\execute(), ApiHelp\execute(), ApiImageRotate\execute(), ApiImport\execute(), ApiLinkAccount\execute(), ApiLogin\execute(), ApiManageTags\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiOpenSearch\execute(), ApiOptions\execute(), ApiParamInfo\execute(), ApiParse\execute(), ApiPatrol\execute(), ApiProtect\execute(), ApiPurge\execute(), ApiQuery\execute(), ApiQueryAllMessages\execute(), ApiQueryAllUsers\execute(), ApiQueryAuthManagerInfo\execute(), ApiQueryBlocks\execute(), ApiQueryCategoryInfo\execute(), ApiQueryContributors\execute(), ApiQueryDeletedrevs\execute(), ApiQueryExternalLinks\execute(), ApiQueryFilearchive\execute(), ApiQueryFileRepoInfo\execute(), ApiQueryImageInfo\execute(), ApiQueryInfo\execute(), ApiQueryIWLinks\execute(), ApiQueryLangLinks\execute(), ApiQueryLogEvents\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryPagePropNames\execute(), ApiQueryPageProps\execute(), ApiQuerySiteinfo\execute(), ApiQueryStashImageInfo\execute(), ApiQueryTags\execute(), ApiQueryTokens\execute(), ApiQueryContributions\execute(), ApiQueryUserInfo\execute(), ApiQueryUsers\execute(), ApiRemoveAuthenticationData\execute(), ApiResetPassword\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiSetNotificationTimestamp\execute(), ApiStashEdit\execute(), ApiTag\execute(), ApiTokens\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiWatch\execute(), ApiHelp\getCustomPrinter(), ApiOpenSearch\getFormat(), ApiFormatJson\getMimeType(), ApiQuery\isReadMode(), ApiQueryAllCategories\run(), ApiQueryAllImages\run(), ApiQueryAllLinks\run(), ApiQueryAllPages\run(), ApiQueryCategories\run(), ApiQueryCategoryMembers\run(), ApiQueryDuplicateFiles\run(), ApiQueryExtLinksUsage\run(), ApiQueryImages\run(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryLinks\run(), ApiQueryPagesWithProp\run(), ApiQueryPrefixSearch\run(), ApiQueryProtectedTitles\run(), ApiQueryQueryPage\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQuerySearch\run(), ApiQueryWatchlist\run(), ApiQueryWatchlistRaw\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), ApiQueryBacklinksprop\run(), ApiQueryDeletedRevisions\run(), ApiQueryRevisions\run(), ApiQueryRandom\runQuery(), and ApiMain\setupExecuteAction().

◆ getAllowedParams()

ApiBase::getAllowedParams ( )
protected

Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (array with PARAM_* constants as keys) Don't call this function directly: use getFinalParams() to allow hooks to modify parameters as needed.

Some derived classes may choose to handle an integer $flags parameter in the overriding methods. Callers of this method can pass zero or more OR-ed flags like GET_VALUES_FOR_HELP.

Returns
array

Reimplemented in ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiCheckToken, ApiClientLogin, ApiComparePages, ApiCSPReport, ApiDelete, ApiEditPage, ApiEmailUser, ApiExpandTemplates, ApiFeedContributions, ApiFeedRecentChanges, ApiFileRevert, ApiFormatBase, ApiFormatJson, ApiFormatPhp, ApiFormatXml, ApiHelp, ApiImport, ApiLinkAccount, ApiLogin, ApiMain, ApiManageTags, ApiMergeHistory, ApiMove, ApiOpenSearch, ApiOptions, ApiParamInfo, ApiParse, ApiPatrol, ApiProtect, ApiQueryAllCategories, ApiQueryAllDeletedRevisions, ApiQueryAllImages, ApiQueryAllLinks, ApiQueryAllMessages, ApiQueryAllPages, ApiQueryAllRevisions, ApiQueryAllUsers, ApiQueryAuthManagerInfo, ApiQueryBacklinks, ApiQueryBacklinksprop, ApiQueryBlocks, ApiQueryCategories, ApiQueryCategoryInfo, ApiQueryCategoryMembers, ApiQueryContributors, ApiQueryDeletedRevisions, ApiQueryDeletedrevs, ApiQueryDisabled, ApiQueryDuplicateFiles, ApiQueryExternalLinks, ApiQueryExtLinksUsage, ApiQueryFilearchive, ApiQueryFileRepoInfo, ApiQueryImageInfo, ApiQueryImages, ApiQueryInfo, ApiQueryIWBacklinks, ApiQueryIWLinks, ApiQueryLangBacklinks, ApiQueryLangLinks, ApiQueryLinks, ApiQueryMyStashedFiles, ApiQueryPagePropNames, ApiQueryPageProps, ApiQueryPagesWithProp, ApiQueryPrefixSearch, ApiQueryProtectedTitles, ApiQueryQueryPage, ApiQueryRandom, ApiQueryRecentChanges, ApiQueryRevisions, ApiQueryRevisionsBase, ApiQuerySearch, ApiQuerySiteinfo, ApiQueryStashImageInfo, ApiQueryTags, ApiQueryTokens, ApiQueryContributions, ApiQueryUserInfo, ApiQueryUsers, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiStashEdit, ApiTag, ApiTokens, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, and MockApi.

Definition at line 345 of file ApiBase.php.

Referenced by getFinalParams().

◆ getConditionalRequestData()

ApiBase::getConditionalRequestData (   $condition)

Returns data for HTTP conditional request mechanisms.

Since
1.26
Parameters
string$conditionCondition being queried:
  • last-modified: Return a timestamp representing the maximum of the last-modified dates for all resources involved in the request. See RFC 7232 § 2.2 for semantics.
  • etag: Return an entity-tag representing the state of all resources involved in the request. Quotes must be included. See RFC 7232 § 2.3 for semantics.
Returns
string|bool|null As described above, or null if no value is available.

Definition at line 449 of file ApiBase.php.

◆ getContinuationManager()

ApiBase::getContinuationManager ( )

Get the continuation manager.

Returns
ApiContinuationManager|null

Reimplemented in ApiMain.

Definition at line 624 of file ApiBase.php.

References dieDebug(), getMain(), and isMain().

Referenced by ApiQueryRecentChanges\run(), ApiQueryAllRevisions\run(), ApiQueryBase\setContinueEnumParameter(), and ApiQueryGeneratorBase\setContinueEnumParameter().

◆ getCustomPrinter()

ApiBase::getCustomPrinter ( )

If the module may only be used with a certain format module, it should override this method to return an instance of that formatter.

A value of null means the default format will be used.

Note
Do not use this just because you don't want to support non-json formats. This should be used only when there is a fundamental requirement for a specific format.
Returns
mixed Instance of a derived class of ApiFormatBase, or null

Reimplemented in ApiFeedContributions, ApiFeedRecentChanges, ApiFeedWatchlist, ApiHelp, ApiOpenSearch, ApiQuery, and ApiRsd.

Definition at line 267 of file ApiBase.php.

◆ getDB()

ApiBase::getDB ( )
protected

Gets a default replica DB connection object.

Returns
Database

Reimplemented in ApiPageSet, ApiQueryAllImages, and ApiQueryBase.

Definition at line 612 of file ApiBase.php.

References $mSlaveDB, DB_REPLICA, and wfGetDB().

Referenced by ApiQuery\doExport(), ApiParse\formatCategoryLinks(), and ApiOpenSearch\search().

◆ getDescription()

ApiBase::getDescription ( )
protected

Returns the description string for this module.

Ignored if an i18n message exists for "apihelp-{$this->getModulePath()}-description".

Deprecated:
since 1.25
Returns
Message|string|array

Definition at line 2655 of file ApiBase.php.

Referenced by getFinalDescription().

◆ getDescriptionMessage()

ApiBase::getDescriptionMessage ( )
protected

Return the description message.

Returns
string|array|Message

Reimplemented in ApiDisabled, ApiLogin, ApiQueryDisabled, and ApiResetPassword.

Definition at line 2326 of file ApiBase.php.

Referenced by getFinalDescription().

◆ getErrorFormatter()

ApiBase::getErrorFormatter ( )

Get the error formatter.

Returns
ApiErrorFormatter

Reimplemented in ApiMain.

Definition at line 598 of file ApiBase.php.

References dieDebug(), getMain(), and isMain().

Referenced by ApiFileRevert\execute(), ApiImageRotate\execute(), ApiManageTags\execute(), ApiQueryUsers\execute(), ApiTag\processIndividual(), and setWarning().

◆ getErrorFromStatus()

ApiBase::getErrorFromStatus (   $status,
$extraData = null 
)

Get error (as code, string) from a Status object.

Since
1.23
Parameters
Status$status
array | null&$extraDataSet if extra data from IApiMessage is available (since 1.27)
Returns
array Array of code and error string
Exceptions
MWException

Definition at line 1630 of file ApiBase.php.

References $code, $messageMap, $status, and wfMessage().

Referenced by dieStatus(), ApiUpload\dieStatusWithCode(), ApiMove\execute(), ApiCSPReport\getReport(), ApiUpload\performStash(), and ApiWatch\watchTitle().

◆ getExamples()

ApiBase::getExamples ( )
protected

Returns usage examples for this module.

Return value as an array is either:

  • numeric keys with partial URLs ("api.php?" plus a query string) as values
  • sequential numeric keys with even-numbered keys being display-text and odd-numbered keys being partial urls
  • partial URLs as keys with display-text (string or array-to-be-joined) as values Return value as a string is the same as an array with a numeric key and that value, and boolean false means "no examples".
Deprecated:
since 1.25, use getExamplesMessages() instead
Returns
bool|string|array

Definition at line 2691 of file ApiBase.php.

Referenced by getExamplesMessages().

◆ getExamplesMessages()

ApiBase::getExamplesMessages ( )
protected

Returns usage examples for this module.

Return value has query strings as keys, with values being either strings (message key), arrays (message key + parameter), or Message objects.

Do not call this base class implementation when overriding this method.

Since
1.25
Returns
array

Reimplemented in ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiCheckToken, ApiClearHasMsg, ApiClientLogin, ApiComparePages, ApiDelete, ApiEditPage, ApiEmailUser, ApiExpandTemplates, ApiFeedContributions, ApiFeedRecentChanges, ApiFeedWatchlist, ApiFileRevert, ApiFormatBase, ApiHelp, ApiImageRotate, ApiImport, ApiLinkAccount, ApiLogin, ApiLogout, ApiMain, ApiManageTags, ApiMergeHistory, ApiMove, ApiOpenSearch, ApiOptions, ApiParamInfo, ApiParse, ApiPatrol, ApiProtect, ApiPurge, ApiQuery, ApiQueryAllCategories, ApiQueryAllDeletedRevisions, ApiQueryAllImages, ApiQueryAllLinks, ApiQueryAllMessages, ApiQueryAllPages, ApiQueryAllRevisions, ApiQueryAllUsers, ApiQueryAuthManagerInfo, ApiQueryBacklinks, ApiQueryBacklinksprop, ApiQueryBlocks, ApiQueryCategories, ApiQueryCategoryInfo, ApiQueryCategoryMembers, ApiQueryContributors, ApiQueryDeletedRevisions, ApiQueryDeletedrevs, ApiQueryDuplicateFiles, ApiQueryExternalLinks, ApiQueryExtLinksUsage, ApiQueryFilearchive, ApiQueryFileRepoInfo, ApiQueryImageInfo, ApiQueryImages, ApiQueryInfo, ApiQueryIWBacklinks, ApiQueryIWLinks, ApiQueryLangBacklinks, ApiQueryLangLinks, ApiQueryLinks, ApiQueryLogEvents, ApiQueryMyStashedFiles, ApiQueryPagePropNames, ApiQueryPageProps, ApiQueryPagesWithProp, ApiQueryPrefixSearch, ApiQueryProtectedTitles, ApiQueryQueryPage, ApiQueryRandom, ApiQueryRecentChanges, ApiQueryRevisions, ApiQuerySearch, ApiQuerySiteinfo, ApiQueryStashImageInfo, ApiQueryTags, ApiQueryTokens, ApiQueryContributions, ApiQueryUserInfo, ApiQueryUsers, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiRsd, ApiSetNotificationTimestamp, ApiTag, ApiTokens, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, and ApiWatch.

Definition at line 282 of file ApiBase.php.

References $ret, as, escapeWikiText(), getExamples(), and ContextSource\msg().

◆ getFinalDescription()

ApiBase::getFinalDescription ( )

Get final module description, after hooks have had a chance to tweak it as needed.

Since
1.25, returns Message[] rather than string[]
Returns
Message[]

Reimplemented in ApiAMCreateAccount, ApiClientLogin, and ApiLinkAccount.

Definition at line 2337 of file ApiBase.php.

References escapeWikiText(), ContextSource\getContext(), getDescription(), getDescriptionMessage(), getModuleName(), getModulePath(), getModulePrefix(), makeMessage(), ContextSource\msg(), and string.

◆ getFinalParamDescription()

ApiBase::getFinalParamDescription ( )

Get final parameter descriptions, after hooks have had a chance to tweak it as needed.

Since
1.25, returns array of Message[] rather than array of string[]
Returns
array Keys are parameter names, values are arrays of Message objects

Definition at line 2400 of file ApiBase.php.

References $line, $name, $params, $path, $value, as, dieDebug(), escapeWikiText(), GET_VALUES_FOR_HELP, ContextSource\getContext(), getFinalParams(), getModuleName(), getModulePath(), getModulePrefix(), getParamDescription(), makeMessage(), ContextSource\msg(), PARAM_HELP_MSG, PARAM_HELP_MSG_APPEND, PARAM_HELP_MSG_PER_VALUE, and PARAM_TYPE.

◆ getFinalParams()

ApiBase::getFinalParams (   $flags = 0)

Get final list of parameters, after hooks have had a chance to tweak it as needed.

Parameters
int$flagsZero or more flags like GET_VALUES_FOR_HELP
Returns
array|bool False on no parameters
Since
1.21 $flags param added

Definition at line 2370 of file ApiBase.php.

References $flags, $params, getAllowedParams(), needsToken(), PARAM_HELP_MSG, PARAM_REQUIRED, PARAM_SENSITIVE, and PARAM_TYPE.

Referenced by extractRequestParams(), getFinalParamDescription(), and getParameter().

◆ getHelpFlags()

ApiBase::getHelpFlags ( )
protected

Generates the list of flags for the help screen and for action=paraminfo.

Corresponding messages: api-help-flag-deprecated, api-help-flag-internal, api-help-flag-readrights, api-help-flag-writerights, api-help-flag-mustbeposted

Returns
string[]

Reimplemented in ApiPurge, and ApiQueryGeneratorBase.

Definition at line 2514 of file ApiBase.php.

References $flags, isDeprecated(), isInternal(), isReadMode(), isWriteMode(), and mustBePosted().

◆ getHelpUrls()

ApiBase::getHelpUrls ( )

Return links to more detailed help pages about the module.

Since
1.25, returning boolean false is deprecated
Returns
string|array

Reimplemented in ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiClearHasMsg, ApiClientLogin, ApiDelete, ApiEditPage, ApiEmailUser, ApiExpandTemplates, ApiFeedWatchlist, ApiFormatBase, ApiHelp, ApiImport, ApiLinkAccount, ApiLogin, ApiLogout, ApiManageTags, ApiMergeHistory, ApiMove, ApiOpenSearch, ApiOptions, ApiParamInfo, ApiParse, ApiPatrol, ApiProtect, ApiPurge, ApiQuery, ApiQueryAllCategories, ApiQueryAllDeletedRevisions, ApiQueryAllImages, ApiQueryAllLinks, ApiQueryAllMessages, ApiQueryAllPages, ApiQueryAllRevisions, ApiQueryAllUsers, ApiQueryAuthManagerInfo, ApiQueryBacklinks, ApiQueryBacklinksprop, ApiQueryBlocks, ApiQueryCategories, ApiQueryCategoryInfo, ApiQueryCategoryMembers, ApiQueryContributors, ApiQueryDeletedRevisions, ApiQueryDeletedrevs, ApiQueryDuplicateFiles, ApiQueryExternalLinks, ApiQueryExtLinksUsage, ApiQueryFilearchive, ApiQueryFileRepoInfo, ApiQueryImageInfo, ApiQueryImages, ApiQueryInfo, ApiQueryIWBacklinks, ApiQueryIWLinks, ApiQueryLangBacklinks, ApiQueryLangLinks, ApiQueryLinks, ApiQueryLogEvents, ApiQueryMyStashedFiles, ApiQueryPagePropNames, ApiQueryPageProps, ApiQueryPagesWithProp, ApiQueryPrefixSearch, ApiQueryProtectedTitles, ApiQueryQueryPage, ApiQueryRandom, ApiQueryRecentChanges, ApiQueryRevisions, ApiQuerySearch, ApiQuerySiteinfo, ApiQueryStashImageInfo, ApiQueryTags, ApiQueryTokens, ApiQueryContributions, ApiQueryUserInfo, ApiQueryUsers, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiSetNotificationTimestamp, ApiTag, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, and ApiWatch.

Definition at line 329 of file ApiBase.php.

◆ getMain()

◆ getModuleFromPath()

ApiBase::getModuleFromPath (   $path)

Get a module from its module path.

Since
1.25
Parameters
string$path
Returns
ApiBase|null
Exceptions
UsageException

Definition at line 546 of file ApiBase.php.

References $count, $path, dieUsage(), and getMain().

Referenced by ApiHelp\execute(), ApiParamInfo\execute(), and ApiDocumentationTest\testDocumentationExists().

◆ getModuleManager()

ApiBase::getModuleManager ( )

Get the module manager, or null if this module has no sub-modules.

Since
1.21
Returns
ApiModuleManager

Reimplemented in ApiMain, and ApiQuery.

Definition at line 254 of file ApiBase.php.

Referenced by ApiFormatBase\closePrinter(), ApiParamInfo\execute(), getParameterFromSettings(), and ApiParamInfo\listAllSubmodules().

◆ getModuleName()

ApiBase::getModuleName ( )

Get the name of the module being executed by this instance.

Returns
string

Reimplemented in MockApiQueryBase.

Definition at line 464 of file ApiBase.php.

References $mModuleName.

Referenced by ApiPageSet\__construct(), ApiContinuationManager\__construct(), ApiContinuationManager\addContinueParam(), ApiContinuationManager\addGeneratorContinueParam(), ApiContinuationManager\addGeneratorNonContinueParam(), ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiBlock\execute(), ApiCheckToken\execute(), ApiClearHasMsg\execute(), ApiComparePages\execute(), ApiCSPReport\execute(), ApiDelete\execute(), ApiEditPage\execute(), ApiEmailUser\execute(), ApiExpandTemplates\execute(), ApiFileRevert\execute(), ApiHelp\execute(), ApiImageRotate\execute(), ApiImport\execute(), ApiManageTags\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiOptions\execute(), ApiParamInfo\execute(), ApiParse\execute(), ApiPatrol\execute(), ApiProtect\execute(), ApiPurge\execute(), ApiQueryAllMessages\execute(), ApiQueryAllUsers\execute(), ApiQueryAuthManagerInfo\execute(), ApiQueryBlocks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryLogEvents\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryPagePropNames\execute(), ApiQueryStashImageInfo\execute(), ApiQueryTags\execute(), ApiQueryTokens\execute(), ApiQueryContributions\execute(), ApiQueryUserInfo\execute(), ApiQueryUsers\execute(), ApiRemoveAuthenticationData\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiSetNotificationTimestamp\execute(), ApiStashEdit\execute(), ApiTag\execute(), ApiTokens\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiWatch\execute(), ApiQueryBacklinksprop\getAllowedParams(), ApiFormatBase\getExamplesMessages(), ApiQueryAllLinks\getExamplesMessages(), ApiQueryBacklinksprop\getExamplesMessages(), ApiQueryLinks\getExamplesMessages(), ApiRemoveAuthenticationData\getExamplesMessages(), ApiAMCreateAccount\getFinalDescription(), getFinalDescription(), ApiClientLogin\getFinalDescription(), ApiLinkAccount\getFinalDescription(), getFinalParamDescription(), ApiQueryAllLinks\getHelpUrls(), ApiQueryBacklinksprop\getHelpUrls(), getModulePath(), getParameterFromSettings(), ApiAuthManagerHelper\logAuthenticationResult(), ApiQueryRevisionsBase\parseParameters(), ApiQueryAllCategories\run(), ApiQueryAllImages\run(), ApiQueryAllLinks\run(), ApiQueryAllPages\run(), ApiQueryCategoryMembers\run(), ApiQueryExtLinksUsage\run(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryPagesWithProp\run(), ApiQueryPrefixSearch\run(), ApiQueryProtectedTitles\run(), ApiQueryQueryPage\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQuerySearch\run(), ApiQueryWatchlist\run(), ApiQueryWatchlistRaw\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), ApiQueryBacklinksprop\run(), ApiQueryRandom\runQuery(), ApiUpload\selectUploadModule(), and setWarning().

◆ getModulePath()

◆ getModulePrefix()

◆ getModuleProfileName()

ApiBase::getModuleProfileName (   $db = false)
Deprecated:
since 1.25, always returns empty string
Parameters
IDatabase | bool$db
Returns
string

Definition at line 2700 of file ApiBase.php.

References wfDeprecated().

◆ getModuleSourceInfo()

ApiBase::getModuleSourceInfo ( )
protected

Returns information about the source of this module, if known.

Returned array is an array with the following keys:

  • path: Install path
  • name: Extension name, or "MediaWiki" for core
  • namemsg: (optional) i18n message key for a display name
  • license-name: (optional) Name of license
Returns
array|null

Definition at line 2547 of file ApiBase.php.

References $ext, $IP, $mModuleSource, $path, as, ContextSource\getConfig(), ExtensionRegistry\getInstance(), and global.

◆ getParamDescription()

ApiBase::getParamDescription ( )
protected

Returns an array of parameter descriptions.

For each parameter, ignored if an i18n message exists for the parameter. By default that message is "apihelp-{$this->getModulePath()}-param-{$param}", but it may be overridden using ApiBase::PARAM_HELP_MSG in the data returned by self::getFinalParams().

Deprecated:
since 1.25
Returns
array|bool False on no parameter descriptions

Definition at line 2671 of file ApiBase.php.

Referenced by getFinalParamDescription().

◆ getParameter()

◆ getParameterFromSettings()

ApiBase::getParameterFromSettings (   $paramName,
  $paramSettings,
  $parseLimit 
)
protected

Using the settings determine the value for the given parameter.

Parameters
string$paramNameParameter name
array | mixed$paramSettingsDefault value or an array of settings using PARAM_* constants.
bool$parseLimitParse limit?
Returns
mixed Parameter value

Reimplemented in ApiFormatBase.

Definition at line 919 of file ApiBase.php.

References $name, $request, $type, $value, as, ChangeTags\canAddTagsAccompanyingChange(), dieDebug(), dieStatus(), dieUsage(), dieUsageMsg(), encodeParamName(), getMain(), getModuleManager(), getModuleName(), ContextSource\getRequest(), getResult(), handleParamNormalization(), logFeatureUsage(), PARAM_ALLOW_DUPLICATES, PARAM_DEPRECATED, PARAM_DFLT, PARAM_ISMULTI, PARAM_MAX, PARAM_MAX2, PARAM_MIN, PARAM_RANGE_ENFORCE, PARAM_REQUIRED, PARAM_TYPE, parseMultiValue(), setWarning(), validateLimit(), validateTimestamp(), and validateUser().

Referenced by extractRequestParams(), and getParameter().

◆ getParent()

ApiBase::getParent ( )

Get the parent of this module.

Since
1.25
Returns
ApiBase|null

Reimplemented in ApiQueryBase.

Definition at line 498 of file ApiBase.php.

References getMain(), and isMain().

Referenced by getModulePath().

◆ getProfileDBTime()

ApiBase::getProfileDBTime ( )
Deprecated:
since 1.25, always returns 0
Returns
float

Definition at line 2755 of file ApiBase.php.

References wfDeprecated().

◆ getProfileTime()

ApiBase::getProfileTime ( )
Deprecated:
since 1.25, always returns 0
Returns
float

Definition at line 2732 of file ApiBase.php.

References wfDeprecated().

◆ getResult()

ApiBase::getResult ( )

Get the result object.

Returns
ApiResult

Reimplemented in ApiMain.

Definition at line 584 of file ApiBase.php.

References dieDebug(), getMain(), and isMain().

Referenced by ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiQuerySiteinfo\appendDbReplLagInfo(), ApiQuerySiteinfo\appendDefaultOptions(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendExtensionTags(), ApiQuerySiteinfo\appendFileExtensions(), ApiQuerySiteinfo\appendFunctionHooks(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInstalledLibraries(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiQuerySiteinfo\appendMagicWords(), ApiQuerySiteinfo\appendNamespaceAliases(), ApiQuerySiteinfo\appendNamespaces(), ApiQuerySiteinfo\appendProtocols(), ApiQuerySiteinfo\appendRestrictions(), ApiQuerySiteinfo\appendRightsInfo(), ApiQuerySiteinfo\appendSkins(), ApiQuerySiteinfo\appendSpecialPageAliases(), ApiQuerySiteinfo\appendStatistics(), ApiQuerySiteinfo\appendSubscribedHooks(), ApiQuerySiteinfo\appendUploadDialog(), ApiQuerySiteinfo\appendUserGroups(), ApiQuerySiteinfo\appendVariables(), ApiFormatRaw\closePrinter(), ApiAMCreateAccount\execute(), ApiBlock\execute(), ApiChangeAuthenticationData\execute(), ApiCheckToken\execute(), ApiClearHasMsg\execute(), ApiClientLogin\execute(), ApiComparePages\execute(), ApiCSPReport\execute(), ApiDelete\execute(), ApiEditPage\execute(), ApiEmailUser\execute(), ApiExpandTemplates\execute(), ApiFeedContributions\execute(), ApiFeedRecentChanges\execute(), ApiFeedWatchlist\execute(), ApiFileRevert\execute(), ApiFormatFeedWrapper\execute(), ApiFormatJson\execute(), ApiFormatPhp\execute(), ApiFormatRaw\execute(), ApiFormatXml\execute(), ApiHelp\execute(), ApiImageRotate\execute(), ApiImport\execute(), ApiLinkAccount\execute(), ApiLogin\execute(), ApiManageTags\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiOpenSearchFormatJson\execute(), ApiOptions\execute(), ApiParamInfo\execute(), ApiParse\execute(), ApiPatrol\execute(), ApiProtect\execute(), ApiPurge\execute(), ApiQuery\execute(), ApiQueryAllMessages\execute(), ApiQueryAllUsers\execute(), ApiQueryAuthManagerInfo\execute(), ApiQueryBlocks\execute(), ApiQueryContributors\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryFileRepoInfo\execute(), ApiQueryImageInfo\execute(), ApiQueryInfo\execute(), ApiQueryLogEvents\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryPagePropNames\execute(), ApiQueryPageProps\execute(), ApiQueryStashImageInfo\execute(), ApiQueryTags\execute(), ApiQueryTokens\execute(), ApiQueryContributions\execute(), ApiQueryUserInfo\execute(), ApiQueryUsers\execute(), ApiRemoveAuthenticationData\execute(), ApiResetPassword\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiRsd\execute(), ApiSetNotificationTimestamp\execute(), ApiStashEdit\execute(), ApiTag\execute(), ApiTokens\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiWatch\execute(), ApiFormatRaw\getFilename(), ApiFormatRaw\getMimeType(), getParameterFromSettings(), ApiFormatFeedWrapper\initPrinter(), ApiFormatRaw\initPrinter(), ApiQuery\outputGeneralPageInfo(), ApiQueryRevisionsBase\parseParameters(), ApiOpenSearch\populateResult(), ApiQueryAllCategories\run(), ApiQueryAllImages\run(), ApiQueryAllLinks\run(), ApiQueryAllPages\run(), ApiQueryCategoryMembers\run(), ApiQueryExtLinksUsage\run(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryPagesWithProp\run(), ApiQueryPrefixSearch\run(), ApiQueryProtectedTitles\run(), ApiQueryQueryPage\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQuerySearch\run(), ApiQueryWatchlist\run(), ApiQueryWatchlistRaw\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), ApiQueryRandom\runQuery(), and ApiUpload\selectUploadModule().

◆ getTitleOrPageId()

ApiBase::getTitleOrPageId (   $params,
  $load = false 
)

Get a WikiPage object from a title or pageid param, if possible.

Can die, if no param is set or if the title or page id is not valid.

Parameters
array$params
bool | string$loadWhether load the object's state from the database:
  • false: don't load (if the pageid is given, it will still be loaded)
  • 'fromdb': load from a replica DB
  • 'fromdbmaster': load from the master database
Returns
WikiPage

Definition at line 840 of file ApiBase.php.

References $params, dieUsage(), dieUsageMsg(), WikiPage\factory(), WikiPage\newFromID(), and requireOnlyOneParameter().

Referenced by ApiDelete\execute(), ApiEditPage\execute(), ApiParse\execute(), ApiProtect\execute(), ApiStashEdit\execute(), and ApiQueryCategoryMembers\run().

◆ getWatchlistUser()

ApiBase::getWatchlistUser (   $params)

Gets the user for whom to get the watchlist.

Parameters
array$params
Returns
User

Definition at line 1465 of file ApiBase.php.

References $params, $user, dieUsage(), and ContextSource\getUser().

Referenced by ApiQueryWatchlist\run(), and ApiQueryWatchlistRaw\run().

◆ getWatchlistValue()

ApiBase::getWatchlistValue (   $watchlist,
  $titleObj,
  $userOption = null 
)
protected

Return true if we're to watch the page, false if not, null if no change.

Parameters
string$watchlistValid values: 'watch', 'unwatch', 'preferences', 'nochange'
Title$titleObjThe page under consideration
string$userOptionThe user option to consider when $watchlist=preferences. If not set will use watchdefault always and watchcreations if $titleObj doesn't exist.
Returns
bool

Definition at line 877 of file ApiBase.php.

References ContextSource\getUser().

Referenced by ApiEditPage\execute(), ApiUpload\performUpload(), and setWatch().

◆ getWebUITokenSalt()

ApiBase::getWebUITokenSalt ( array  $params)
protected

Fetch the salt used in the Web UI corresponding to this module.

Only override this if the Web UI uses a token with a non-constant salt.

Since
1.24
Parameters
array$paramsAll supplied parameters for the module
Returns
string|array|null

Reimplemented in ApiUserrights.

Definition at line 433 of file ApiBase.php.

Referenced by validateToken().

◆ handleParamNormalization()

ApiBase::handleParamNormalization (   $paramName,
  $value,
  $rawValue 
)
protected

Handle when a parameter was Unicode-normalized.

Since
1.28
Parameters
string$paramNameUnprefixed parameter name
string$valueInput that will be used.
string$rawValueInput before normalization.

Reimplemented in ApiPageSet.

Definition at line 1191 of file ApiBase.php.

References encodeParamName(), and setWarning().

Referenced by getParameterFromSettings().

◆ isDeprecated()

ApiBase::isDeprecated ( )

Indicates whether this module is deprecated.

Since
1.25
Returns
bool

Reimplemented in ApiLogin, ApiQueryDeletedrevs, and ApiTokens.

Definition at line 388 of file ApiBase.php.

Referenced by getHelpFlags().

◆ isInternal()

ApiBase::isInternal ( )

Indicates whether this module is "internal" Internal API modules are not (yet) intended for 3rd party use and may be unstable.

Since
1.25
Returns
bool

Reimplemented in ApiCSPReport, and ApiStashEdit.

Definition at line 398 of file ApiBase.php.

Referenced by getHelpFlags().

◆ isMain()

ApiBase::isMain ( )

Returns true if this module is the main module ($this === $this->mMainModule), false otherwise.

Returns
bool

Definition at line 489 of file ApiBase.php.

References $mMainModule.

Referenced by __construct(), getContinuationManager(), getErrorFormatter(), getModulePath(), getParent(), getResult(), lacksSameOriginSecurity(), and setContinuationManager().

◆ isReadMode()

ApiBase::isReadMode ( )

Indicates whether this module requires read rights.

Returns
bool

Reimplemented in ApiAMCreateAccount, ApiClientLogin, ApiCSPReport, ApiDisabled, ApiHelp, ApiLinkAccount, ApiLogin, ApiLogout, ApiMain, ApiParamInfo, ApiQuery, ApiQueryAuthManagerInfo, ApiQueryTokens, and ApiRsd.

Definition at line 363 of file ApiBase.php.

Referenced by getHelpFlags().

◆ isWriteMode()

◆ lacksSameOriginSecurity()

ApiBase::lacksSameOriginSecurity ( )

◆ logFeatureUsage()

ApiBase::logFeatureUsage (   $feature)

◆ makeMessage()

static ApiBase::makeMessage (   $msg,
IContextSource  $context,
array  $params = null 
)
static

Create a Message from a string or array.

A string is used as a message key. An array has the message key as the first value and message parameters as subsequent values.

Since
1.25
Parameters
string | array | Message$msg
IContextSource$context
array$params
Returns
Message|null

Definition at line 1522 of file ApiBase.php.

References ContextSource\$context, $params, and wfMessage().

Referenced by ApiDocumentationTest\checkMessage(), ApiAMCreateAccount\getFinalDescription(), getFinalDescription(), ApiClientLogin\getFinalDescription(), ApiLinkAccount\getFinalDescription(), getFinalParamDescription(), ApiHelp\getHelpInternal(), and ApiParamInfo\getModuleInfo().

◆ modifyHelp()

ApiBase::modifyHelp ( array $help,
array  $options,
array $tocData 
)

Called from ApiHelp before the pieces are joined together and returned.

This exists mainly for ApiMain to add the Permissions and Credits sections. Other modules probably don't need it.

Parameters
string[]&$helpArray of help data
array$optionsOptions passed to ApiHelp::getHelp
array&$tocDataIf a TOC is being generated, this array has keys as anchors in the page and values as for Linker::generateTOC().

Reimplemented in ApiMain.

Definition at line 2636 of file ApiBase.php.

◆ mustBePosted()

ApiBase::mustBePosted ( )

◆ needsToken()

ApiBase::needsToken ( )

Returns the token type this module requires in order to execute.

Modules are strongly encouraged to use the core 'csrf' type unless they have specialized security needs. If the token type is not one of the core types, you must use the ApiQueryTokensRegisterTypes hook to register it.

Returning a non-falsey value here will force the addition of an appropriate 'token' parameter in self::getFinalParams(). Also, self::mustBePosted() must return true when tokens are used.

In previous versions of MediaWiki, true was a valid return value. Returning true will generate errors indicating that the API module needs updating.

Returns
string|false

Reimplemented in ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiClientLogin, ApiDelete, ApiEditPage, ApiEmailUser, ApiFileRevert, ApiImageRotate, ApiImport, ApiLinkAccount, ApiManageTags, ApiMergeHistory, ApiMove, ApiOptions, ApiPatrol, ApiProtect, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiSetNotificationTimestamp, ApiStashEdit, ApiTag, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, and ApiWatch.

Definition at line 420 of file ApiBase.php.

Referenced by getFinalParams(), mustBePosted(), and validateToken().

◆ parameterNotEmpty()

ApiBase::parameterNotEmpty (   $x)
private

Callback function used in requireOnlyOneParameter to check whether required parameters are set.

Parameters
object$xParameter to check is not null/false
Returns
bool

Definition at line 825 of file ApiBase.php.

◆ parseMsg()

ApiBase::parseMsg (   $error)

Return the error message related to a certain array.

Parameters
array | string | MessageSpecifier$errorElement of a getUserPermissionsErrors()-style array
Returns
[ 'code' => code, 'info' => info ]

Definition at line 2253 of file ApiBase.php.

References $params, parseMsg(), wfDebug(), wfGetAllCallers(), and wfMsgReplaceArgs().

Referenced by ApiMain\checkBotReadOnly(), ApiImageRotate\checkPermissions(), ApiUpload\checkVerification(), dieReadOnly(), ApiUpload\dieRecoverableError(), dieUsageMsg(), dieUsageMsgOrDebug(), ApiBlock\execute(), ApiPurge\execute(), ApiUnblock\execute(), ApiMove\moveSubpages(), parseMsg(), and ApiTag\processIndividual().

◆ parseMultiValue()

ApiBase::parseMultiValue (   $valueName,
  $value,
  $allowMultiple,
  $allowedValues 
)
protected

Return an array of values that were given in a 'a|b|c' notation, after it optionally validates them against the list allowed values.

Parameters
string$valueNameThe name of the parameter (for error reporting)
mixed$valueThe value being parsed
bool$allowMultipleCan $value contain more than one value separated by '|'?
string[] | null$allowedValuesAn array of values to check against. If null, all values are accepted.
Returns
string|string[] (allowMultiple ? an_array_of_values : a_single_value)

Definition at line 1231 of file ApiBase.php.

References $s, $value, dieUsage(), explodeMultiValue(), LIMIT_SML1, LIMIT_SML2, logFeatureUsage(), and setWarning().

Referenced by getParameterFromSettings().

◆ profileDBIn()

ApiBase::profileDBIn ( )
Deprecated:
since 1.25

Definition at line 2740 of file ApiBase.php.

References wfDeprecated().

◆ profileDBOut()

ApiBase::profileDBOut ( )
Deprecated:
since 1.25

Definition at line 2747 of file ApiBase.php.

References wfDeprecated().

◆ profileIn()

ApiBase::profileIn ( )
Deprecated:
since 1.25

Definition at line 2708 of file ApiBase.php.

◆ profileOut()

ApiBase::profileOut ( )
Deprecated:
since 1.25

Definition at line 2716 of file ApiBase.php.

◆ requireAtLeastOneParameter()

ApiBase::requireAtLeastOneParameter (   $params,
  $required 
)

Die if none of a certain set of parameters is set and not false.

Since
1.23
Parameters
array$paramsUser provided set of parameters, as from $this->extractRequestParams()
string$required,...Names of parameters of which at least one must be set

Definition at line 770 of file ApiBase.php.

References $params, dieUsage(), and getModulePrefix().

Referenced by ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiLinkAccount\execute(), and ApiTag\execute().

◆ requireMaxOneParameter()

ApiBase::requireMaxOneParameter (   $params,
  $required 
)

Die if more than one of a certain set of parameters is set and not false.

Parameters
array$paramsUser provided set of parameters, as from $this->extractRequestParams()
string$required,...Names of parameters of which at most one must be set

Definition at line 747 of file ApiBase.php.

References $params, dieUsage(), and getModulePrefix().

Referenced by ApiExpandTemplates\execute(), ApiImport\execute(), ApiQueryBlocks\execute(), ApiQueryContributors\execute(), ApiQueryIWLinks\execute(), ApiQueryLangLinks\execute(), ApiQueryLogEvents\execute(), ApiSetNotificationTimestamp\execute(), ApiQueryRandom\run(), and ApiQueryAllRevisions\run().

◆ requireOnlyOneParameter()

ApiBase::requireOnlyOneParameter (   $params,
  $required 
)

Die if none or more than one of a certain set of parameters is set and not false.

Parameters
array$paramsUser provided set of parameters, as from $this->extractRequestParams()
string$required,...Names of parameters of which exactly one must be set

Definition at line 721 of file ApiBase.php.

References $params, dieUsage(), and getModulePrefix().

Referenced by ApiMergeHistory\execute(), ApiMove\execute(), ApiPatrol\execute(), ApiResetPassword\execute(), ApiRollback\getRbTitle(), getTitleOrPageId(), ApiUserrights\getUrUser(), and ApiUpload\selectUploadModule().

◆ requirePostedParameters()

ApiBase::requirePostedParameters (   $params,
  $prefix = 'prefix' 
)

Die if any of the specified parameters were found in the query part of the URL rather than the post body.

Since
1.28
Parameters
string[]$paramsParameters to check
string$prefixSet to 'noprefix' to skip calling $this->encodeParamName()

Definition at line 793 of file ApiBase.php.

References $params, as, dieUsage(), encodeParamName(), ContextSource\getConfig(), getMain(), and ContextSource\getRequest().

Referenced by ApiLogin\execute().

◆ safeProfileOut()

ApiBase::safeProfileOut ( )
Deprecated:
since 1.25

Definition at line 2724 of file ApiBase.php.

References wfDeprecated().

◆ setContinuationManager()

ApiBase::setContinuationManager (   $manager)

Set the continuation manager.

Parameters
ApiContinuationManager|null

Reimplemented in ApiMain.

Definition at line 638 of file ApiBase.php.

References dieDebug(), getMain(), and isMain().

Referenced by ApiImageRotate\execute(), ApiPurge\execute(), ApiQuery\execute(), ApiSetNotificationTimestamp\execute(), and ApiWatch\execute().

◆ setWarning()

◆ setWatch()

ApiBase::setWatch (   $watch,
  $titleObj,
  $userOption = null 
)
protected

Set a watch (or unwatch) based the based on a watchlist parameter.

Parameters
string$watchValid values: 'watch', 'unwatch', 'preferences', 'nochange'
Title$titleObjThe article's title to change
string$userOptionThe user option to consider when $watch=preferences

Definition at line 1434 of file ApiBase.php.

References $value, WatchAction\doWatchOrUnwatch(), ContextSource\getUser(), and getWatchlistValue().

Referenced by ApiDelete\execute(), ApiMove\execute(), ApiProtect\execute(), ApiRollback\execute(), and ApiUndelete\execute().

◆ shouldCheckMaxlag()

ApiBase::shouldCheckMaxlag ( )

Indicates if this module needs maxlag to be checked.

Returns
bool

Reimplemented in ApiHelp.

Definition at line 355 of file ApiBase.php.

◆ truncateArray()

static ApiBase::truncateArray ( $arr,
  $limit 
)
static

Truncate an array to a certain length.

Parameters
array$arrArray to truncate
int$limitMaximum length
Returns
bool True if the array was truncated, false otherwise

Definition at line 1449 of file ApiBase.php.

References $limit.

◆ useTransactionalTimeLimit()

◆ validateLimit()

ApiBase::validateLimit (   $paramName,
$value,
  $min,
  $max,
  $botMax = null,
  $enforceLimits = false 
)
protected

Validate the value against the minimum and user/bot maximum limits.

Prints usage info on failure.

Parameters
string$paramNameParameter name
int$valueParameter value
int | null$minMinimum value
int | null$maxMaximum value for users
int$botMaxMaximum value for sysops/bots
bool$enforceLimitsWhether to enforce (die) if value is outside limits

Definition at line 1296 of file ApiBase.php.

References $value, encodeParamName(), getMain(), and warnOrDie().

Referenced by ApiQueryDeletedrevs\execute(), getParameterFromSettings(), and ApiQueryRevisionsBase\parseParameters().

◆ validateTimestamp()

ApiBase::validateTimestamp (   $value,
  $encParamName 
)
protected

Validate and normalize of parameters of type 'timestamp'.

Parameters
string$valueParameter value
string$encParamNameParameter name
Returns
string Validated and normalized parameter

Definition at line 1335 of file ApiBase.php.

References $value, dieUsage(), logFeatureUsage(), setWarning(), TS_MW, TS_UNIX, and wfTimestamp().

Referenced by getParameterFromSettings().

◆ validateToken()

ApiBase::validateToken (   $token,
array  $params 
)
final

Validate the supplied token.

Since
1.24
Parameters
string$tokenSupplied token
array$paramsAll supplied parameters for the module
Returns
bool
Exceptions
MWException

Definition at line 1374 of file ApiBase.php.

References ContextSource\getRequest(), ApiQueryTokens\getToken(), ApiQueryTokens\getTokenTypeSalts(), ContextSource\getUser(), getWebUITokenSalt(), and needsToken().

◆ validateUser()

ApiBase::validateUser (   $value,
  $encParamName 
)
private

Validate and normalize of parameters of type 'user'.

Parameters
string$valueParameter value
string$encParamNameParameter name
Returns
string Validated and normalized parameter

Definition at line 1409 of file ApiBase.php.

References $title, $value, dieUsage(), and NS_USER.

Referenced by getParameterFromSettings().

◆ warnOrDie()

ApiBase::warnOrDie (   $msg,
  $enforceLimits = false 
)
private

Adds a warning to the output, else dies.

Parameters
string$msgMessage to show as a warning, or error message if dying
bool$enforceLimitsWhether this is an enforce (die)

Definition at line 1565 of file ApiBase.php.

References dieUsage(), and setWarning().

Referenced by validateLimit().

Member Data Documentation

◆ $extensionInfo

array ApiBase::$extensionInfo = null
staticprivate

Maps extension paths to info arrays.

Definition at line 200 of file ApiBase.php.

◆ $messageMap

ApiBase::$messageMap
static

Array that maps message keys to error messages.

$1 and friends are replaced.

Definition at line 1684 of file ApiBase.php.

Referenced by ApiErrorFormatter_BackCompat\addWarningOrError(), ApiRollback\execute(), and getErrorFromStatus().

◆ $mMainModule

ApiMain ApiBase::$mMainModule
private

Definition at line 203 of file ApiBase.php.

Referenced by getMain(), and isMain().

◆ $mModuleName

string ApiBase::$mModuleName
private

Definition at line 205 of file ApiBase.php.

Referenced by getModuleName().

◆ $mModulePrefix

string ApiBase::$mModulePrefix
private

Definition at line 205 of file ApiBase.php.

Referenced by getModulePrefix().

◆ $mModuleSource

array null bool ApiBase::$mModuleSource = false
private

Definition at line 209 of file ApiBase.php.

Referenced by getModuleSourceInfo().

◆ $mParamCache

ApiBase::$mParamCache = []
private

Definition at line 207 of file ApiBase.php.

◆ $mSlaveDB

ApiBase::$mSlaveDB = null
private

Definition at line 206 of file ApiBase.php.

Referenced by getDB().

◆ GET_VALUES_FOR_HELP

const ApiBase::GET_VALUES_FOR_HELP = 1

getAllowedParams() flag: When set, the result could take longer to generate, but should be more thorough.

E.g. get the list of generators for ApiSandBox extension

Since
1.21

Definition at line 197 of file ApiBase.php.

Referenced by ApiPageSet\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), getFinalParamDescription(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), and ApiDocumentationTest\testDocumentationExists().

◆ LIMIT_BIG1

const ApiBase::LIMIT_BIG1 = 500

Fast query, standard limit.

Definition at line 184 of file ApiBase.php.

Referenced by buildCommonApiParams(), ApiQueryDeletedrevs\execute(), ApiQueryLogEvents\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiQueryRevisionsBase\parseParameters(), and ApiQueryBacklinks\run().

◆ LIMIT_BIG2

const ApiBase::LIMIT_BIG2 = 5000

Fast query, apihighlimits limit.

Definition at line 186 of file ApiBase.php.

Referenced by buildCommonApiParams(), ApiQueryDeletedrevs\execute(), ApiQueryLogEvents\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiQueryRevisionsBase\parseParameters(), and ApiQueryBacklinks\run().

◆ LIMIT_SML1

◆ LIMIT_SML2

const ApiBase::LIMIT_SML2 = 500

◆ PARAM_ALLOW_DUPLICATES

const ApiBase::PARAM_ALLOW_DUPLICATES = 6

(boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true?

Definition at line 103 of file ApiBase.php.

Referenced by ApiProtect\getAllowedParams(), ApiQueryAllMessages\getAllowedParams(), ApiParamInfo\getModuleInfo(), and getParameterFromSettings().

◆ PARAM_DEPRECATED

◆ PARAM_DFLT

const ApiBase::PARAM_DFLT = 0

(null|boolean|integer|string) Default value of the parameter.

Definition at line 50 of file ApiBase.php.

Referenced by buildCommonApiParams(), buildProfileApiParam(), ApiFeedWatchlist\getAllowedParams(), ApiPageSet\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiCSPReport\getAllowedParams(), ApiDelete\getAllowedParams(), ApiEditPage\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiFileRevert\getAllowedParams(), ApiFormatBase\getAllowedParams(), ApiFormatJson\getAllowedParams(), ApiFormatPhp\getAllowedParams(), ApiFormatXml\getAllowedParams(), ApiHelp\getAllowedParams(), ApiMain\getAllowedParams(), ApiManageTags\getAllowedParams(), ApiMove\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiOptions\getAllowedParams(), ApiParamInfo\getAllowedParams(), ApiParse\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllDeletedRevisions\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllMessages\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllRevisions\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedRevisions\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryFileRepoInfo\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryTokens\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiRevisionDelete\getAllowedParams(), ApiRollback\getAllowedParams(), ApiStashEdit\getAllowedParams(), ApiTag\getAllowedParams(), ApiTokens\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiUpload\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiOpenSearch\getFormat(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), ApiFormatBase\getParameterFromSettings(), ApiAuthManagerHelper\getStandardParams(), ApiBaseTest\provideGetParameterFromSettings(), and ApiOpenSearchTest\testGetAllowedParams().

◆ PARAM_HELP_MSG

const ApiBase::PARAM_HELP_MSG = 10

(string|array|Message) Specify an alternative i18n documentation message for this parameter.

Default is apihelp-{$path}-param-{$param}.

Since
1.25

Definition at line 125 of file ApiBase.php.

Referenced by buildCommonApiParams(), buildProfileApiParam(), ApiFeedWatchlist\getAllowedParams(), ApiImageRotate\getAllowedParams(), ApiPageSet\getAllowedParams(), ApiPurge\getAllowedParams(), ApiQuery\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiSetNotificationTimestamp\getAllowedParams(), ApiWatch\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiFormatBase\getAllowedParams(), ApiFormatJson\getAllowedParams(), ApiFormatPhp\getAllowedParams(), ApiFormatXml\getAllowedParams(), ApiLogin\getAllowedParams(), ApiParse\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllDeletedRevisions\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllRevisions\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryInfo\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedRevisions\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryInfo\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryPageProps\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), getFinalParamDescription(), getFinalParams(), ApiAuthManagerHelper\getStandardParams(), and ApiDocumentationTest\testDocumentationExists().

◆ PARAM_HELP_MSG_APPEND

◆ PARAM_HELP_MSG_INFO

const ApiBase::PARAM_HELP_MSG_INFO = 12

(array) Specify additional information tags for the parameter.

Value is an array of arrays, with the first member being the 'tag' for the info and the remaining members being the values. In the help, this is formatted using apihelp-{$path}-paraminfo-{$tag}, which is passed $1 = count, $2 = comma-joined list of values, $3 = module prefix.

Since
1.25

Definition at line 142 of file ApiBase.php.

Referenced by ApiQueryAllDeletedRevisions\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), and ApiDocumentationTest\testDocumentationExists().

◆ PARAM_HELP_MSG_PER_VALUE

const ApiBase::PARAM_HELP_MSG_PER_VALUE = 14

((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg for ApiBase::makeMessage().

Any value not having a mapping will use apihelp-{$path}-paramvalue-{$param}-{$value}.

Since
1.25

Definition at line 157 of file ApiBase.php.

Referenced by buildProfileApiParam(), ApiFeedWatchlist\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiParse\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryInfo\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), getFinalParamDescription(), and ApiDocumentationTest\testDocumentationExists().

◆ PARAM_ISMULTI

const ApiBase::PARAM_ISMULTI = 1

(boolean) Accept multiple pipe-separated values for this parameter (e.g.

titles)?

Definition at line 53 of file ApiBase.php.

Referenced by buildCommonApiParams(), ApiPageSet\getAllowedParams(), ApiQuery\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiDelete\getAllowedParams(), ApiEditPage\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiHelp\getAllowedParams(), ApiOptions\getAllowedParams(), ApiParamInfo\getAllowedParams(), ApiParse\getAllowedParams(), ApiPatrol\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllDeletedRevisions\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllMessages\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllRevisions\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryFileRepoInfo\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryInfo\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPageProps\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryTokens\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiRevisionDelete\getAllowedParams(), ApiRollback\getAllowedParams(), ApiTag\getAllowedParams(), ApiTokens\getAllowedParams(), ApiUnblock\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiUpload\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), ApiAuthManagerHelper\getStandardParams(), and ApiBaseTest\provideGetParameterFromSettings().

◆ PARAM_MAX

const ApiBase::PARAM_MAX = 3

(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.

Definition at line 91 of file ApiBase.php.

Referenced by buildCommonApiParams(), ApiFeedWatchlist\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiUpload\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), and getParameterFromSettings().

◆ PARAM_MAX2

const ApiBase::PARAM_MAX2 = 4

(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'.

Definition at line 97 of file ApiBase.php.

Referenced by buildCommonApiParams(), ApiQueryLogEvents\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), and getParameterFromSettings().

◆ PARAM_MIN

const ApiBase::PARAM_MIN = 5

(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.

Definition at line 100 of file ApiBase.php.

Referenced by buildCommonApiParams(), ApiFeedWatchlist\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiUpload\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), and getParameterFromSettings().

◆ PARAM_RANGE_ENFORCE

const ApiBase::PARAM_RANGE_ENFORCE = 9

(boolean) For PARAM_TYPE 'integer', enforce PARAM_MIN and PARAM_MAX?

Since
1.17

Definition at line 118 of file ApiBase.php.

Referenced by ApiParamInfo\getModuleInfo(), and getParameterFromSettings().

◆ PARAM_REQUIRED

◆ PARAM_SENSITIVE

const ApiBase::PARAM_SENSITIVE = 17

(boolean) Is the parameter sensitive? Note 'password'-type fields are always sensitive regardless of the value of this field.

Since
1.28

Definition at line 179 of file ApiBase.php.

Referenced by ApiCheckToken\getAllowedParams(), ApiLogin\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), and getFinalParams().

◆ PARAM_SUBMODULE_MAP

const ApiBase::PARAM_SUBMODULE_MAP = 15

(string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths.

Default is to use all modules in $this->getModuleManager() in the group matching the parameter name.

Since
1.26

Definition at line 165 of file ApiBase.php.

Referenced by ApiPageSet\getAllowedParams(), ApiHelp\getHelpInternal(), and ApiParamInfo\getModuleInfo().

◆ PARAM_SUBMODULE_PARAM_PREFIX

const ApiBase::PARAM_SUBMODULE_PARAM_PREFIX = 16

(string) When PARAM_TYPE is 'submodule', used to indicate the 'g' prefix added by ApiQueryGeneratorBase (and similar if anything else ever does that).

Since
1.26

Definition at line 172 of file ApiBase.php.

Referenced by ApiPageSet\getAllowedParams(), and ApiParamInfo\getModuleInfo().

◆ PARAM_TYPE

const ApiBase::PARAM_TYPE = 2

(string|string[]) Either an array of allowed value strings, or a string type as described below.

If not specified, will be determined from the type of PARAM_DFLT.

Supported string types are:

  • boolean: A boolean parameter, returned as false if the parameter is omitted and true if present (even with a falsey value, i.e. it works like HTML checkboxes). PARAM_DFLT must be boolean false, if specified. Cannot be used with PARAM_ISMULTI.
  • integer: An integer value. See also PARAM_MIN, PARAM_MAX, and PARAM_RANGE_ENFORCE.
  • limit: An integer or the string 'max'. Default lower limit is 0 (but see PARAM_MIN), and requires that PARAM_MAX and PARAM_MAX2 be specified. Cannot be used with PARAM_ISMULTI.
  • namespace: An integer representing a MediaWiki namespace.
  • NULL: Any string.
  • password: Any non-empty string. Input value is private or sensitive. <input type="password"> would be an appropriate HTML form field.
  • string: Any non-empty string, not expected to be very long or contain newlines. <input type="text"> would be an appropriate HTML form field.
  • submodule: The name of a submodule of this module, see PARAM_SUBMODULE_MAP.
  • tags: A string naming an existing, explicitly-defined tag. Should usually be used with PARAM_ISMULTI.
  • text: Any non-empty string, expected to be very long or contain newlines. <textarea> would be an appropriate HTML form field.
  • timestamp: A timestamp in any format recognized by MWTimestamp, or the string 'now' representing the current timestamp. Will be returned in TS_MW format.
  • user: A MediaWiki username or IP. Will be returned normalized but not canonicalized.
  • upload: An uploaded file. Will be returned as a WebRequestUpload object. Cannot be used with PARAM_ISMULTI.

Definition at line 88 of file ApiBase.php.

Referenced by buildCommonApiParams(), buildProfileApiParam(), ApiFeedWatchlist\getAllowedParams(), ApiImageRotate\getAllowedParams(), ApiPageSet\getAllowedParams(), ApiQuery\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiSetNotificationTimestamp\getAllowedParams(), ApiWatch\getAllowedParams(), ApiBlock\getAllowedParams(), ApiCheckToken\getAllowedParams(), ApiComparePages\getAllowedParams(), ApiCSPReport\getAllowedParams(), ApiDelete\getAllowedParams(), ApiEditPage\getAllowedParams(), ApiEmailUser\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiFileRevert\getAllowedParams(), ApiFormatJson\getAllowedParams(), ApiFormatPhp\getAllowedParams(), ApiImport\getAllowedParams(), ApiLogin\getAllowedParams(), ApiMain\getAllowedParams(), ApiManageTags\getAllowedParams(), ApiMergeHistory\getAllowedParams(), ApiMove\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiOptions\getAllowedParams(), ApiParamInfo\getAllowedParams(), ApiParse\getAllowedParams(), ApiPatrol\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllDeletedRevisions\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllMessages\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllRevisions\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryAuthManagerInfo\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryDeletedRevisions\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryFileRepoInfo\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryInfo\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryTokens\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiResetPassword\getAllowedParams(), ApiRevisionDelete\getAllowedParams(), ApiRollback\getAllowedParams(), ApiStashEdit\getAllowedParams(), ApiTag\getAllowedParams(), ApiTokens\getAllowedParams(), ApiUnblock\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiUpload\getAllowedParams(), ApiUserrights\getAllowedParams(), getFinalParamDescription(), getFinalParams(), ApiOpenSearch\getFormat(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), ApiAuthManagerHelper\getStandardParams(), and ApiDocumentationTest\testDocumentationExists().

◆ PARAM_VALUE_LINKS

const ApiBase::PARAM_VALUE_LINKS = 13

(string[]) When PARAM_TYPE is an array, this may be an array mapping those values to page titles which will be linked in the help.

Since
1.25

Definition at line 149 of file ApiBase.php.

Referenced by ApiHelp\getHelpInternal().


The documentation for this class was generated from the following file: