MediaWiki master
ApiBase Class Reference

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

Inherits MediaWiki\Context\ContextSource.

Inherited by ApiAMCreateAccount, ApiAcquireTempUserName, ApiBlock, ApiCSPReport, ApiChangeAuthenticationData, ApiChangeContentModel, 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, ApiSetPageLanguage, ApiStashEdit, ApiTag, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, ApiValidatePassword, and ApiWatch.

Collaboration diagram for ApiBase:

Public Attributes

const PARAM_RANGE_ENFORCE = 'api-param-range-enforce'
 (boolean) Inverse of IntegerDef::PARAM_IGNORE_RANGE
 
Old constants for ::getAllowedParams() arrays
const PARAM_DFLT = ParamValidator::PARAM_DEFAULT
 
const PARAM_ISMULTI = ParamValidator::PARAM_ISMULTI
 
const PARAM_TYPE = ParamValidator::PARAM_TYPE
 
const PARAM_MAX = IntegerDef::PARAM_MAX
 
const PARAM_MAX2 = IntegerDef::PARAM_MAX2
 
const PARAM_MIN = IntegerDef::PARAM_MIN
 
const PARAM_ALLOW_DUPLICATES = ParamValidator::PARAM_ALLOW_DUPLICATES
 
const PARAM_DEPRECATED = ParamValidator::PARAM_DEPRECATED
 
const PARAM_REQUIRED = ParamValidator::PARAM_REQUIRED
 
const PARAM_SUBMODULE_MAP = SubmoduleDef::PARAM_SUBMODULE_MAP
 
const PARAM_SUBMODULE_PARAM_PREFIX = SubmoduleDef::PARAM_SUBMODULE_PARAM_PREFIX
 
const PARAM_ALL = ParamValidator::PARAM_ALL
 
const PARAM_EXTRA_NAMESPACES = NamespaceDef::PARAM_EXTRA_NAMESPACES
 
const PARAM_SENSITIVE = ParamValidator::PARAM_SENSITIVE
 
const PARAM_DEPRECATED_VALUES = EnumDef::PARAM_DEPRECATED_VALUES
 
const PARAM_ISMULTI_LIMIT1 = ParamValidator::PARAM_ISMULTI_LIMIT1
 
const PARAM_ISMULTI_LIMIT2 = ParamValidator::PARAM_ISMULTI_LIMIT2
 
const PARAM_MAX_BYTES = StringDef::PARAM_MAX_BYTES
 
const PARAM_MAX_CHARS = StringDef::PARAM_MAX_CHARS
 

API-specific constants for ::getAllowedParams() arrays

const PARAM_HELP_MSG = 'api-param-help-msg'
 (string|array|Message) Specify an alternative i18n documentation message for this parameter.
 
const PARAM_HELP_MSG_APPEND = 'api-param-help-msg-append'
 ((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this parameter.
 
const PARAM_HELP_MSG_INFO = 'api-param-help-msg-info'
 (array) Specify additional information tags for the parameter.
 
const PARAM_VALUE_LINKS = 'api-param-value-links'
 Deprecated and unused.
 
const PARAM_HELP_MSG_PER_VALUE = 'api-param-help-msg-per-value'
 ((string|array|Message)[]) When PARAM_TYPE is an array, or 'string' with PARAM_ISMULTI, this is an array mapping parameter values to help message specifiers (to be passed to ApiBase::makeMessage()) about those values.
 
const PARAM_TEMPLATE_VARS = 'param-template-vars'
 (array) Indicate that this is a templated parameter, and specify replacements.
 
const ALL_DEFAULT_STRING = '*'
 (string|array|Message) Specify an alternative i18n documentation message for this parameter.
 
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.
 
const GET_VALUES_FOR_HELP = 1
 getAllowedParams() flag: When this is set, the result could take longer to generate, but should be more thorough.
 
 __construct (ApiMain $mainModule, $moduleName, $modulePrefix='')
 

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 submodules.
 
 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 considered to be "internal".
 
 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 ()
 
 getContinuationManager ()
 
 setContinuationManager (ApiContinuationManager $manager=null)
 
 getDB ()
 Gets a default replica DB connection object.
 
 getPermissionManager ()
 Obtain a PermissionManager instance that subclasses may use in their authorization checks.
 
 getHookContainer ()
 Get a HookContainer, for running extension hooks or for hook metadata.
 
 getHookRunner ()
 Get an ApiHookRunner for running core API hooks.
 

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 ( $options=[])
 Using getAllowedParams(), this function makes an array of the values provided by the user, with the key being the name of the variable, and value - validated value from user or default.
 
 requireOnlyOneParameter ( $params,... $required)
 Die if 0 or more than one of a certain set of parameters is set and not false.
 
 requireMaxOneParameter ( $params,... $required)
 Dies if more than one parameter from a certain set of parameters are set and not false.
 
 requireAtLeastOneParameter ( $params,... $required)
 Die if 0 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 HTTP post body contents.
 
 getTitleOrPageId ( $params, $load=false)
 Attempts to load a WikiPage object from a title or pageid parameter, if possible.
 
 getTitleFromTitleOrPageId ( $params)
 Get a Title object from a title or pageid param, if it is possible.
 
 handleParamNormalization ( $paramName, $value, $rawValue)
 Handle when a parameter was Unicode-normalized.
 
 validateToken ( $token, array $params)
 Validate the supplied token.
 
 getParameter ( $paramName, $parseLimit=true)
 Get a value for the given parameter.
 
 getParameterFromSettings ( $name, $settings, $parseLimit)
 Using the settings, determine the value for the given parameter.
 

Utility methods

 getWatchlistUser ( $params)
 Gets the user for whom to get the watchlist.
 
 errorArrayToStatus (array $errors, Authority $performer=null)
 Turn an array of messages into a Status.
 
 addBlockInfoToStatus (StatusValue $status, Authority $user=null)
 Add block info to block messages in a Status.
 
 useTransactionalTimeLimit ()
 Call wfTransactionalTimeLimit() if this request was POSTed.
 
 filterIDs ( $fields, array $ids)
 Filter out-of-range values from a list of positive integer IDs.
 
static makeMessage ( $msg, IContextSource $context, array $params=null)
 Create a Message from a string or array.
 
static clearCacheForTest ()
 Reset static caches of database state.
 

Warning and error reporting

 addWarning ( $msg, $code=null, $data=null)
 Add a warning for this module.
 
 addDeprecation ( $msg, $feature, $data=[])
 Add a deprecation warning for this module.
 
 addError ( $msg, $code=null, $data=null)
 Add an error for this module without aborting.
 
 addMessagesFromStatus (StatusValue $status, $types=[ 'warning', 'error'], array $filter=[])
 Add warnings and/or errors from a Status.
 
 dieWithError ( $msg, $code=null, $data=null, $httpCode=0)
 Abort execution with an error.
 
 dieWithException (Throwable $exception, array $options=[])
 Abort execution with an error derived from a throwable.
 
 dieBlocked (Block $block)
 Throw an ApiUsageException, which will (if uncaught) call the main module's error handler and die with an error message including block info.
 
 dieStatus (StatusValue $status)
 Throw an ApiUsageException based on the Status object.
 
 dieReadOnly ()
 Helper function for readonly errors.
 
 checkUserRightsAny ( $rights)
 Helper function for permission-denied errors.
 
 checkTitleUserPermissions (PageIdentity $pageIdentity, $actions, array $options=[])
 Helper function for permission-denied errors.
 
 dieWithErrorOrDebug ( $msg, $code=null, $data=null, $httpCode=null)
 Will only set a warning instead of failing if the global $wgDebugAPI is set to true.
 
 logFeatureUsage ( $feature)
 Write logging information for API features to a debug log, for usage analysis.
 
 parseContinueParamOrDie (string $continue, array $types)
 Parse the 'continue' parameter in the usual format and validate the types of each part, or die with the 'badcontinue' error if the format, types, or the number of parts is wrong.
 
 dieContinueUsageIf ( $condition)
 Die with the 'badcontinue' error.
 
static dieDebug ( $method, $message)
 Internal code errors should be reported with this method.
 

Help message generation

 getFinalSummary ()
 Get the final module summary.
 
 getFinalDescription ()
 Get the final module description, after hooks have had a chance to tweak it as needed.
 
 getFinalParams ( $flags=0)
 Get the 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.
 
 getSummaryMessage ()
 Return the summary message.
 
 getExtendedDescription ()
 Return the extended help text 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.
 

Additional Inherited Members

- Public Member Functions inherited from MediaWiki\Context\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.
 
 getActionName ()
 Get the action name for the current web request.
 
 getAuthority ()
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens.
 
 getLanguage ()
 
 getLanguageCode ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

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

Stability: stable
to extend

Definition at line 64 of file ApiBase.php.

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented in ApiOpenSearchFormatJson.

Definition at line 292 of file ApiBase.php.

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

Member Function Documentation

◆ addBlockInfoToStatus()

ApiBase::addBlockInfoToStatus ( StatusValue  $status,
Authority  $user = null 
)

Add block info to block messages in a Status.

Since
1.33
Access: internal
since 1.37, should become protected in the future.
Parameters
StatusValue$status
Authority | null$user

Definition at line 1351 of file ApiBase.php.

References getAuthority(), StatusValue\getErrors(), MessageSpecifier\getKey(), and StatusValue\replaceMessage().

◆ addDeprecation()

ApiBase::addDeprecation (   $msg,
  $feature,
  $data = [] 
)

Add a deprecation warning for this module.

A combination of $this->addWarning() and $this->logFeatureUsage()

Since
1.29
Parameters
string | array | Message$msgSee ApiErrorFormatter::addWarning()
string | null$featureSee ApiBase::logFeatureUsage()
array | null$dataSee ApiErrorFormatter::addWarning()

Definition at line 1465 of file ApiBase.php.

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

◆ addError()

ApiBase::addError (   $msg,
  $code = null,
  $data = null 
)

Add an error for this module without aborting.

If $msg is not an ApiMessage, the message code will be derived from the message key by stripping any "apiwarn-" or "apierror-" prefix.

Note
If you want to abort processing, use self::dieWithError() instead.
Since
1.29
Parameters
string | array | Message$msgSee ApiErrorFormatter::addError()
string | null$codeSee ApiErrorFormatter::addError()
array | null$dataSee ApiErrorFormatter::addError()

Definition at line 1498 of file ApiBase.php.

◆ addMessagesFromStatus()

ApiBase::addMessagesFromStatus ( StatusValue  $status,
  $types = [ 'warning', 'error' ],
array  $filter = [] 
)

Add warnings and/or errors from a Status.

Note
If you want to abort processing, use self::dieStatus() instead.
Since
1.29
Parameters
StatusValue$status
string[]$types'warning' and/or 'error'
string[]$filterMessage keys to filter out (since 1.33)

Definition at line 1511 of file ApiBase.php.

Referenced by ApiUndelete\execute().

◆ addWarning()

ApiBase::addWarning (   $msg,
  $code = null,
  $data = null 
)

Add a warning for this module.

Users should monitor this section to notice any changes in the API.

Multiple calls to this function will result in multiple warning messages.

If $msg is not an ApiMessage, the message code will be derived from the message key by stripping any "apiwarn-" or "apierror-" prefix.

Since
1.29
Parameters
string | array | Message$msgSee ApiErrorFormatter::addWarning()
string | null$codeSee ApiErrorFormatter::addWarning()
array | null$dataSee ApiErrorFormatter::addWarning()

Definition at line 1451 of file ApiBase.php.

Referenced by ApiFormatXml\addXslt(), ApiCheckToken\execute(), ApiComparePages\execute(), ApiDelete\execute(), ApiExpandTemplates\execute(), ApiOptions\execute(), ApiParamInfo\execute(), ApiPurge\execute(), ApiQueryDisabled\execute(), ApiQueryLanguageinfo\execute(), ApiQueryTokens\execute(), ApiQueryImageInfo\mergeThumbParams(), ApiQueryRevisionsBase\parseParameters(), and ApiQueryAllDeletedRevisions\run().

◆ checkTitleUserPermissions()

ApiBase::checkTitleUserPermissions ( PageIdentity  $pageIdentity,
  $actions,
array  $options = [] 
)

Helper function for permission-denied errors.

Parameters
PageIdentity$pageIdentity
string | string[]$actions
array$optionsAdditional options
  • user: (User) User to use rather than $this->getUser().
  • autoblock: (bool, default false) Whether to spread autoblocks.
Exceptions
ApiUsageExceptionif the user doesn't have all the necessary rights.
Since
1.29
1.33 Changed the third parameter from $user to $options.
1.36 deprecated passing LinkTarget as first parameter

Definition at line 1672 of file ApiBase.php.

References getAuthority(), and getUser().

Referenced by ApiEditPage\execute(), ApiFileRevert\execute(), ApiImageRotate\execute(), ApiProtect\execute(), and ApiSetPageLanguage\execute().

◆ checkUserRightsAny()

ApiBase::checkUserRightsAny (   $rights)

Helper function for permission-denied errors.

Since
1.29
Parameters
string | string[]$rights
Exceptions
ApiUsageExceptionif the user doesn't have any of the rights. The error message is based on $rights[0].

Definition at line 1649 of file ApiBase.php.

References getAuthority().

Referenced by ApiAcquireTempUserName\execute(), ApiBlock\execute(), ApiChangeContentModel\execute(), ApiOptions\execute(), ApiQueryDeletedrevs\execute(), ApiRevisionDelete\execute(), ApiSetNotificationTimestamp\execute(), ApiSetPageLanguage\execute(), ApiTag\execute(), and ApiWatch\execute().

◆ clearCacheForTest()

static ApiBase::clearCacheForTest ( )
static

Reset static caches of database state.

Access: internal
For testing only

Definition at line 1392 of file ApiBase.php.

◆ dieBlocked()

ApiBase::dieBlocked ( Block  $block)

Throw an ApiUsageException, 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 ApiUsageException
Exceptions
ApiUsageExceptionalways
Returns
never

Definition at line 1562 of file ApiBase.php.

References getContext(), getRequest(), and getUser().

Referenced by ApiEditPage\execute(), ApiPurge\execute(), ApiRevisionDelete\execute(), ApiTag\execute(), ApiUndelete\execute(), and ApiUserrights\execute().

◆ dieContinueUsageIf()

ApiBase::dieContinueUsageIf (   $condition)
protected

Die with the 'badcontinue' error.

This call is common enough to make it into the base method.

Parameters
bool$conditionWill only die if this value is true
Exceptions
ApiUsageException
Since
1.21

Definition at line 1764 of file ApiBase.php.

Referenced by ApiQueryInfo\execute(), ApiQueryUserContribs\execute(), and ApiQueryRandom\run().

◆ dieDebug()

◆ dieReadOnly()

ApiBase::dieReadOnly ( )

Helper function for readonly errors.

Exceptions
ApiUsageExceptionalways
Returns
never

Definition at line 1633 of file ApiBase.php.

Referenced by ApiEditPage\execute().

◆ dieStatus()

◆ dieWithError()

ApiBase::dieWithError (   $msg,
  $code = null,
  $data = null,
  $httpCode = 0 
)

Abort execution with an error.

If $msg is not an ApiMessage, the message code will be derived from the message key by stripping any "apiwarn-" or "apierror-" prefix.

Since
1.29
Parameters
string | array | Message$msgSee ApiErrorFormatter::addError()
string | null$codeSee ApiErrorFormatter::addError()
array | null$dataSee ApiErrorFormatter::addError()
int$httpCodeHTTP error code to use
Exceptions
ApiUsageExceptionalways
Returns
never

Definition at line 1533 of file ApiBase.php.

Referenced by ApiQuerySiteinfo\appendDbReplLagInfo(), ApiQueryImageInfo\checkParameterNormalise(), ApiAcquireTempUserName\execute(), ApiAMCreateAccount\execute(), ApiBlock\execute(), ApiChangeAuthenticationData\execute(), ApiChangeContentModel\execute(), ApiClientLogin\execute(), ApiComparePages\execute(), ApiDelete\execute(), ApiDisabled\execute(), ApiEditPage\execute(), ApiEmailUser\execute(), ApiExpandTemplates\execute(), ApiFeedContributions\execute(), ApiFeedRecentChanges\execute(), ApiFeedWatchlist\execute(), ApiImport\execute(), ApiLinkAccount\execute(), ApiLogout\execute(), ApiManageTags\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiOpenSearchFormatJson\execute(), ApiOptions\execute(), ApiPatrol\execute(), ApiProtect\execute(), ApiQueryAllMessages\execute(), ApiQueryBlocks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryExternalLinks\execute(), ApiQueryFilearchive\execute(), ApiQueryImageInfo\execute(), ApiQueryInfo\execute(), ApiQueryIWLinks\execute(), ApiQueryLangLinks\execute(), ApiQueryLogEvents\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryStashImageInfo\execute(), ApiQueryUserContribs\execute(), ApiRemoveAuthenticationData\execute(), ApiResetPassword\execute(), ApiRevisionDelete\execute(), ApiSetNotificationTimestamp\execute(), ApiSetPageLanguage\execute(), ApiStashEdit\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiValidatePassword\execute(), ApiWatch\execute(), ApiQueryAllImages\executeGenerator(), ApiQueryAllPages\executeGenerator(), getModuleFromPath(), ApiQueryImageInfo\mergeThumbParams(), ApiQueryRevisionsBase\parseParameters(), ApiQueryBase\parsePrefixedTitlePart(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryRecentChanges\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryDeletedRevisions\run(), ApiQueryRevisions\run(), ApiQueryBase\titlePartToKey(), and ApiFileRevert\validateParameters().

◆ dieWithErrorOrDebug()

ApiBase::dieWithErrorOrDebug (   $msg,
  $code = null,
  $data = null,
  $httpCode = null 
)

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

Otherwise, it behaves exactly as self::dieWithError().

Since
1.29
Parameters
string | array | Message$msg
string | null$code
array | null$data
int | null$httpCode
Exceptions
ApiUsageException

Definition at line 1707 of file ApiBase.php.

◆ dieWithException()

ApiBase::dieWithException ( Throwable  $exception,
array  $options = [] 
)

Abort execution with an error derived from a throwable.

Since
1.29
Parameters
Throwable$exceptionSee ApiErrorFormatter::getMessageFromException()
array$optionsSee ApiErrorFormatter::getMessageFromException()
Exceptions
ApiUsageExceptionalways
Returns
never

Definition at line 1546 of file ApiBase.php.

Referenced by ApiEditPage\execute(), ApiImport\execute(), ApiQueryStashImageInfo\execute(), and ApiStashEdit\execute().

◆ dynamicParameterDocumentation()

ApiBase::dynamicParameterDocumentation ( )

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

Stability: stable
to override
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 777 of file ApiBase.php.

◆ encodeParamName()

ApiBase::encodeParamName (   $paramName)

◆ errorArrayToStatus()

ApiBase::errorArrayToStatus ( array  $errors,
Authority  $performer = null 
)

Turn an array of messages into a Status.

See also
ApiMessage::create
Since
1.29
Parameters
array$errorsA list of message keys, MessageSpecifier objects, or arrays containing the message key and parameters.
Authority | null$performer
Returns
Status

Definition at line 1314 of file ApiBase.php.

References getAuthority().

Referenced by ApiPatrol\execute().

◆ 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 ApiAcquireTempUserName, ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiChangeContentModel, 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, ApiQueryLanguageinfo, ApiQueryLinks, ApiQueryLogEvents, ApiQueryMyStashedFiles, ApiQueryPagePropNames, ApiQueryPageProps, ApiQueryPagesWithProp, ApiQueryPrefixSearch, ApiQueryProtectedTitles, ApiQueryQueryPage, ApiQueryRandom, ApiQueryRecentChanges, ApiQueryRevisionsBase, ApiQuerySearch, ApiQuerySiteinfo, ApiQueryStashImageInfo, ApiQueryTags, ApiQueryTokens, ApiQueryUserContribs, ApiQueryUserInfo, ApiQueryUsers, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiRsd, ApiSetNotificationTimestamp, ApiSetPageLanguage, ApiStashEdit, ApiTag, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, ApiValidatePassword, and ApiWatch.

◆ extractRequestParams()

ApiBase::extractRequestParams (   $options = [])

Using getAllowedParams(), this function makes an array of the values provided by the user, with the 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 | array$optionsIf a boolean, uses that as the value for 'parseLimit'
  • parseLimit: (bool, default true) Whether to parse the 'max' value for limit types
  • safeMode: (bool, default false) If true, avoid throwing for parameter validation errors. Returned parameter values might be ApiUsageException instances.
Returns
array

Definition at line 811 of file ApiBase.php.

References $params, and wfEscapeWikiText().

Referenced by ApiPageSet\__construct(), ApiContinuationManager\__construct(), ApiAuthManagerHelper\__construct(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiAMCreateAccount\execute(), ApiBlock\execute(), ApiChangeContentModel\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(), 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(), ApiQueryUserContribs\execute(), ApiQueryUserInfo\execute(), ApiQueryUsers\execute(), ApiRemoveAuthenticationData\execute(), ApiResetPassword\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiSetNotificationTimestamp\execute(), ApiSetPageLanguage\execute(), ApiStashEdit\execute(), ApiTag\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiValidatePassword\execute(), ApiWatch\execute(), ApiHelp\getCustomPrinter(), ApiFormatJson\getMimeType(), ApiQuery\isReadMode(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), ApiQueryDeletedRevisions\run(), ApiQueryRevisions\run(), and ApiQueryRandom\runQuery().

◆ filterIDs()

ApiBase::filterIDs (   $fields,
array  $ids 
)
protected

Filter out-of-range values from a list of positive integer IDs.

Since
1.33
Parameters
string[][]$fieldsArray of table and field pairs to check
(string|int)[]$ids IDs to filter. Strings in the array are expected to be stringified integers.
Returns
(string|int)[] Filtered IDs.

Definition at line 1408 of file ApiBase.php.

References getDB().

Referenced by ApiQueryBase\addWhereIDsFld().

◆ 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.

Stability: stable
to override
Returns
array

Reimplemented in ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiChangeContentModel, 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, ApiQueryAuthManagerInfo, ApiQueryBacklinks, ApiQueryBacklinksprop, ApiQueryBlocks, ApiQueryCategories, ApiQueryCategoryInfo, ApiQueryCategoryMembers, ApiQueryDeletedRevisions, ApiQueryDeletedrevs, ApiQueryDuplicateFiles, ApiQueryExternalLinks, ApiQueryExtLinksUsage, ApiQueryFilearchive, ApiQueryFileRepoInfo, ApiQueryImageInfo, ApiQueryImages, ApiQueryInfo, ApiQueryIWBacklinks, ApiQueryIWLinks, ApiQueryLangBacklinks, ApiQueryLangLinks, ApiQueryLanguageinfo, ApiQueryLinks, ApiQueryMyStashedFiles, ApiQueryPagePropNames, ApiQueryPageProps, ApiQueryPagesWithProp, ApiQueryPrefixSearch, ApiQueryProtectedTitles, ApiQueryQueryPage, ApiQueryRandom, ApiQueryRecentChanges, ApiQueryRevisions, ApiQueryRevisionsBase, ApiQuerySearch, ApiQuerySiteinfo, ApiQueryStashImageInfo, ApiQueryTags, ApiQueryTokens, ApiQueryUserContribs, ApiQueryUserInfo, ApiQueryUsers, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiSetPageLanguage, ApiStashEdit, ApiTag, ApiUnblock, ApiUndelete, ApiUpload, and ApiValidatePassword.

Definition at line 391 of file ApiBase.php.

◆ getConditionalRequestData()

ApiBase::getConditionalRequestData (   $condition)

Returns data for HTTP conditional request mechanisms.

Since
1.26
Stability: stable
to override
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 517 of file ApiBase.php.

◆ getContinuationManager()

ApiBase::getContinuationManager ( )

◆ 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.
Stability: stable
to override
Returns
ApiFormatBase|null An instance of a class derived from ApiFormatBase, or null

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

Definition at line 347 of file ApiBase.php.

◆ getDB()

ApiBase::getDB ( )
protected

Gets a default replica DB connection object.

Stability: stable
to override
Returns
IReadableDatabase

Reimplemented in ApiPageSet, ApiQueryAllImages, and ApiQueryBase.

Definition at line 695 of file ApiBase.php.

◆ getErrorFormatter()

◆ 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
Stability: stable
to override
Returns
array

Reimplemented in ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiChangeContentModel, 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, ApiQueryLanguageinfo, ApiQueryLinks, ApiQueryLogEvents, ApiQueryMyStashedFiles, ApiQueryPagePropNames, ApiQueryPageProps, ApiQueryPagesWithProp, ApiQueryPrefixSearch, ApiQueryProtectedTitles, ApiQueryQueryPage, ApiQueryRandom, ApiQueryRecentChanges, ApiQueryRevisions, ApiQuerySearch, ApiQuerySiteinfo, ApiQueryStashImageInfo, ApiQueryTags, ApiQueryTokens, ApiQueryUserContribs, ApiQueryUserInfo, ApiQueryUsers, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiRsd, ApiSetNotificationTimestamp, ApiSetPageLanguage, ApiTag, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, ApiValidatePassword, and ApiWatch.

Definition at line 363 of file ApiBase.php.

◆ getExtendedDescription()

ApiBase::getExtendedDescription ( )
protected

Return the extended help text message.

This is additional text to display at the top of the help section, below the summary.

Since
1.30
Stability: stable
to override
Returns
string|array|Message

Reimplemented in ApiDisabled, ApiLogin, ApiQueryDisabled, ApiResetPassword, and ApiSetPageLanguage.

Definition at line 1848 of file ApiBase.php.

◆ getFinalDescription()

ApiBase::getFinalDescription ( )

Get the 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 1877 of file ApiBase.php.

References getContext().

◆ 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 1937 of file ApiBase.php.

References $params, $path, and getContext().

◆ getFinalParams()

ApiBase::getFinalParams (   $flags = 0)

Get the 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
Since
1.21 $flags param added

Definition at line 1906 of file ApiBase.php.

References $params.

◆ getFinalSummary()

ApiBase::getFinalSummary ( )

Get the final module summary.

Since
1.30
Stability: stable
to override
Returns
Message

Definition at line 1862 of file ApiBase.php.

References getContext().

◆ 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 ApiQueryGeneratorBase.

Definition at line 2085 of file ApiBase.php.

◆ getHelpUrls()

ApiBase::getHelpUrls ( )

Return links to more detailed help pages about the module.

Since
1.25, returning boolean false is deprecated
Stability: stable
to override
Returns
string|array

Reimplemented in ApiAMCreateAccount, ApiBlock, ApiChangeAuthenticationData, ApiChangeContentModel, ApiCheckToken, ApiClearHasMsg, ApiClientLogin, ApiComparePages, ApiDelete, ApiEditPage, ApiEmailUser, ApiExpandTemplates, ApiFeedContributions, ApiFeedRecentChanges, ApiFeedWatchlist, ApiFileRevert, ApiFormatBase, ApiHelp, ApiImageRotate, 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, ApiQueryUserContribs, ApiQueryUserInfo, ApiQueryUsers, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiRsd, ApiSetNotificationTimestamp, ApiSetPageLanguage, ApiStashEdit, ApiTag, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, ApiValidatePassword, and ApiWatch.

Definition at line 374 of file ApiBase.php.

◆ getHookContainer()

ApiBase::getHookContainer ( )
protected

Get a HookContainer, for running extension hooks or for hook metadata.

Since
1.35
Returns
HookContainer

Definition at line 741 of file ApiBase.php.

Referenced by ApiQueryBase\select().

◆ getHookRunner()

◆ getMain()

◆ getModuleFromPath()

ApiBase::getModuleFromPath (   $path)

Get a module from its module path.

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

Definition at line 631 of file ApiBase.php.

References $path, dieWithError(), getMain(), and wfEscapeWikiText().

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

◆ getModuleManager()

ApiBase::getModuleManager ( )

Get the module manager, or null if this module has no submodules.

Since
1.21
Stability: stable
to override
Returns
ApiModuleManager|null

Reimplemented in ApiMain, and ApiQuery.

Definition at line 331 of file ApiBase.php.

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

◆ getModuleName()

ApiBase::getModuleName ( )

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

Returns
string

Definition at line 532 of file ApiBase.php.

Referenced by ApiPageSet\__construct(), ApiContinuationManager\__construct(), ApiContinuationManager\addContinueParam(), ApiContinuationManager\addGeneratorContinueParam(), ApiContinuationManager\addGeneratorNonContinueParam(), ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiAcquireTempUserName\execute(), ApiBlock\execute(), ApiChangeContentModel\execute(), ApiCheckToken\execute(), ApiClearHasMsg\execute(), ApiComparePages\execute(), ApiCSPReport\execute(), ApiDelete\execute(), ApiDisabled\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(), ApiPatrol\execute(), ApiProtect\execute(), ApiPurge\execute(), ApiQueryAllMessages\execute(), ApiQueryAllUsers\execute(), ApiQueryAuthManagerInfo\execute(), ApiQueryBlocks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryDisabled\execute(), ApiQueryFilearchive\execute(), ApiQueryLanguageinfo\execute(), ApiQueryLogEvents\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryPagePropNames\execute(), ApiQueryStashImageInfo\execute(), ApiQueryTags\execute(), ApiQueryTokens\execute(), ApiQueryUserContribs\execute(), ApiQueryUserInfo\execute(), ApiQueryUsers\execute(), ApiRemoveAuthenticationData\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiSetNotificationTimestamp\execute(), ApiSetPageLanguage\execute(), ApiStashEdit\execute(), ApiTag\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiValidatePassword\execute(), ApiWatch\execute(), ApiQueryBacklinksprop\getAllowedParams(), ApiFormatBase\getExamplesMessages(), ApiQueryAllLinks\getExamplesMessages(), ApiQueryBacklinksprop\getExamplesMessages(), ApiQueryLanguageinfo\getExamplesMessages(), ApiQueryLinks\getExamplesMessages(), ApiRemoveAuthenticationData\getExamplesMessages(), ApiAMCreateAccount\getFinalDescription(), ApiClientLogin\getFinalDescription(), ApiLinkAccount\getFinalDescription(), ApiQueryAllLinks\getHelpUrls(), ApiQueryBacklinksprop\getHelpUrls(), getModulePath(), ApiAuthManagerHelper\logAuthenticationResult(), ApiQueryRevisionsBase\parseParameters(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), and ApiQueryRandom\runQuery().

◆ getModulePath()

◆ getModulePrefix()

◆ 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 2118 of file ApiBase.php.

References $path.

◆ getParameter()

ApiBase::getParameter (   $paramName,
  $parseLimit = true 
)
protected

◆ getParameterFromSettings()

ApiBase::getParameterFromSettings (   $name,
  $settings,
  $parseLimit 
)
protected

Using the settings, determine the value for the given parameter.

Parameters
string$nameParameter name
array | mixed$settingsDefault value or an array of settings using PARAM_* constants.
bool$parseLimitWhether to parse and validate 'limit' parameters
Returns
mixed Parameter value

Reimplemented in ApiFormatBase.

Definition at line 1170 of file ApiBase.php.

◆ getParent()

ApiBase::getParent ( )

Get the parent of this module.

Stability: stable
to override
Since
1.25
Returns
ApiBase|null

Reimplemented in ApiQueryBase.

Definition at line 571 of file ApiBase.php.

References getMain(), and isMain().

Referenced by getModulePath().

◆ getPermissionManager()

ApiBase::getPermissionManager ( )
protected

Obtain a PermissionManager instance that subclasses may use in their authorization checks.

Since
1.34
Returns
PermissionManager

Definition at line 731 of file ApiBase.php.

References getPermissionManager().

Referenced by ApiProtect\execute(), ApiQueryAllUsers\execute(), ApiQueryUsers\execute(), ApiRevisionDelete\execute(), ApiQueryAllUsers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryUserInfo\getCurrentUserInfo(), getPermissionManager(), and ApiTag\processIndividual().

◆ getResult()

ApiBase::getResult ( )

Get the result object.

Returns
ApiResult

Reimplemented in ApiMain.

Definition at line 671 of file ApiBase.php.

References getMain().

Referenced by ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiQuerySiteinfo\appendAutoCreateTempUser(), ApiQuerySiteinfo\appendDbReplLagInfo(), ApiQuerySiteinfo\appendDefaultOptions(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendExtensionTags(), ApiQuerySiteinfo\appendFileExtensions(), ApiQuerySiteinfo\appendFunctionHooks(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInstalledClientLibraries(), ApiQuerySiteinfo\appendInstalledLibraries(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiQuerySiteinfo\appendLanguageVariants(), 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(), ApiFormatBase\closePrinter(), ApiFormatRaw\closePrinter(), ApiAcquireTempUserName\execute(), ApiAMCreateAccount\execute(), ApiBlock\execute(), ApiChangeAuthenticationData\execute(), ApiChangeContentModel\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(), 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(), ApiQueryLanguageinfo\execute(), ApiQueryLogEvents\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryPagePropNames\execute(), ApiQueryPageProps\execute(), ApiQueryStashImageInfo\execute(), ApiQueryTags\execute(), ApiQueryTokens\execute(), ApiQueryUserContribs\execute(), ApiQueryUserInfo\execute(), ApiQueryUsers\execute(), ApiRemoveAuthenticationData\execute(), ApiResetPassword\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiRsd\execute(), ApiSetNotificationTimestamp\execute(), ApiSetPageLanguage\execute(), ApiStashEdit\execute(), ApiTag\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiValidatePassword\execute(), ApiWatch\execute(), ApiFormatRaw\getFilename(), ApiFormatRaw\getMimeType(), ApiFormatFeedWrapper\initPrinter(), ApiFormatRaw\initPrinter(), ApiQueryRevisionsBase\parseParameters(), ApiOpenSearch\populateResult(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), and ApiQueryRandom\runQuery().

◆ getSummaryMessage()

ApiBase::getSummaryMessage ( )
protected

Return the summary message.

This is a one-line description of the module, suitable for display in a list of modules.

Since
1.30
Stability: stable
to override
Returns
string|array|Message

Reimplemented in ApiDisabled, ApiQueryContributors, and ApiQueryDisabled.

Definition at line 1834 of file ApiBase.php.

◆ getTitleFromTitleOrPageId()

ApiBase::getTitleFromTitleOrPageId (   $params)

Get a Title object from a title or pageid param, if it is possible.

It can die if no param is set or if the title or page ID is not valid.

Since
1.29
Parameters
array$paramsUser provided parameter set, as from $this->extractRequestParams()
Returns
Title

Definition at line 1137 of file ApiBase.php.

References $params, and wfEscapeWikiText().

◆ getTitleOrPageId()

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

Attempts to load a WikiPage object from a title or pageid parameter, if possible.

It can die if no param is set or if the title or page ID is not valid.

Parameters
array$paramsUser provided parameter set, as from $this->extractRequestParams()
string | false$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 primary database
Returns
WikiPage

Definition at line 1098 of file ApiBase.php.

References $params, and wfEscapeWikiText().

Referenced by ApiChangeContentModel\execute(), ApiDelete\execute(), ApiEditPage\execute(), ApiProtect\execute(), ApiSetPageLanguage\execute(), and ApiStashEdit\execute().

◆ getWatchlistUser()

ApiBase::getWatchlistUser (   $params)

Gets the user for whom to get the watchlist.

Parameters
array$params
Returns
User

Definition at line 1246 of file ApiBase.php.

References $params, getUser(), and wfEscapeWikiText().

◆ 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
Stability: stable
to override
Returns
string|array|null

Reimplemented in ApiLogout, and ApiUserrights.

Definition at line 500 of file ApiBase.php.

◆ handleParamNormalization()

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

Handle when a parameter was Unicode-normalized.

Since
1.28
1.35 $paramName is prefixed
Access: internal
For overriding by subclasses and use by ApiParamValidatorCallbacks only.
Parameters
string$paramNamePrefixed parameter name
string$valueInput that will be used.
string$rawValueInput before normalization.

Reimplemented in ApiPageSet.

Definition at line 1198 of file ApiBase.php.

◆ isDeprecated()

ApiBase::isDeprecated ( )

Indicates whether this module is deprecated.

Since
1.25
Stability: stable
to override
Returns
bool

Reimplemented in ApiLogin, and ApiQueryDeletedrevs.

Definition at line 450 of file ApiBase.php.

◆ isInternal()

ApiBase::isInternal ( )

Indicates whether this module is considered to be "internal".

Internal API modules are not (yet) intended for 3rd party use and may be unstable.

Since
1.25
Stability: stable
to override
Returns
bool

Reimplemented in ApiCSPReport, and ApiStashEdit.

Definition at line 463 of file ApiBase.php.

◆ isMain()

ApiBase::isMain ( )

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

Returns
bool

Definition at line 560 of file ApiBase.php.

Referenced by __construct(), getModulePath(), and getParent().

◆ isReadMode()

ApiBase::isReadMode ( )

Indicates whether this module requires read rights.

Stability: stable
to override
Returns
bool

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

Definition at line 413 of file ApiBase.php.

◆ isWriteMode()

ApiBase::isWriteMode ( )

Indicates whether this module requires write mode.

This should return true for modules that may require synchronous database writes. Modules that do not need such writes should also not rely on primary database access, since only read queries are needed and each primary DB is a single point of failure. Additionally, requests that only need replica DBs can be efficiently routed to any datacenter via the Promise-Non-Write-API-Action header.

Stability: stable
to override
Returns
bool

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

Definition at line 429 of file ApiBase.php.

Referenced by ApiMain\setRequestExpectations().

◆ lacksSameOriginSecurity()

ApiBase::lacksSameOriginSecurity ( )

Returns true if the current request breaks the same-origin policy.

For example, json with callbacks.

https://en.wikipedia.org/wiki/Same-origin_policy

Since
1.25
Returns
bool

Reimplemented in ApiMain.

Definition at line 598 of file ApiBase.php.

References getMain().

Referenced by ApiLogin\execute(), ApiQueryDeletedrevs\execute(), and ApiQueryTokens\execute().

◆ logFeatureUsage()

ApiBase::logFeatureUsage (   $feature)

Write logging information for API features to a debug log, for usage analysis.

Note
Consider using $this->addDeprecation() instead to both warn and log.
Parameters
string$featureFeature being used.

Definition at line 1788 of file ApiBase.php.

References getRequest(), getUser(), wfDebugLog(), and wfUrlencode().

◆ 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 | null$params
Returns
Message|null

Definition at line 1285 of file ApiBase.php.

References $params, and wfMessage().

Referenced by ApiAMCreateAccount\getFinalDescription(), ApiClientLogin\getFinalDescription(), and ApiLinkAccount\getFinalDescription().

◆ 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.

Stability: stable
to override
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 SectionMetadata::fromLegacy().

Reimplemented in ApiMain.

Definition at line 2199 of file ApiBase.php.

◆ 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.

Stability: stable
to override
Returns
string|false

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

Definition at line 486 of file ApiBase.php.

Referenced by mustBePosted().

◆ parseContinueParamOrDie()

ApiBase::parseContinueParamOrDie ( string  $continue,
array  $types 
)
protected

Parse the 'continue' parameter in the usual format and validate the types of each part, or die with the 'badcontinue' error if the format, types, or the number of parts is wrong.

Parameters
string$continueValue of 'continue' parameter obtained from extractRequestParams()
string[]$typesTypes of the expected parts in order, 'string', 'int' or 'timestamp'
Returns
mixed[] Array containing strings, integers or timestamps
Exceptions
ApiUsageException
Since
1.40

Definition at line 1725 of file ApiBase.php.

Referenced by ApiQueryBlocks\execute(), ApiQueryContributors\execute(), ApiQueryDeletedrevs\execute(), ApiQueryExternalLinks\execute(), ApiQueryFilearchive\execute(), ApiQueryImageInfo\execute(), ApiQueryInfo\execute(), ApiQueryIWLinks\execute(), ApiQueryLangLinks\execute(), ApiQueryLogEvents\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryPagePropNames\execute(), ApiQueryPageProps\execute(), ApiQueryUserContribs\execute(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), ApiQueryDeletedRevisions\run(), and ApiQueryRevisions\run().

◆ requireAtLeastOneParameter()

ApiBase::requireAtLeastOneParameter (   $params,
  $required 
)

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

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

Definition at line 1010 of file ApiBase.php.

References $params.

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

◆ requireMaxOneParameter()

ApiBase::requireMaxOneParameter (   $params,
  $required 
)

Dies if more than one parameter from a certain set of parameters are set and not false.

Parameters
array$paramsUser provided parameters set, as from $this->extractRequestParams()
string...$required Parameter names that cannot have more than one set

Definition at line 985 of file ApiBase.php.

References $params.

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

◆ requireOnlyOneParameter()

ApiBase::requireOnlyOneParameter (   $params,
  $required 
)

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

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

Definition at line 950 of file ApiBase.php.

References $params.

Referenced by ApiBlock\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiPatrol\execute(), ApiQueryUserContribs\execute(), ApiStashEdit\execute(), and ApiUnblock\execute().

◆ 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 HTTP post body contents.

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

Definition at line 1038 of file ApiBase.php.

References $params, getRequest(), and wfDeprecatedMsg().

Referenced by ApiLogin\execute(), and ApiValidatePassword\execute().

◆ setContinuationManager()

ApiBase::setContinuationManager ( ApiContinuationManager  $manager = null)
Parameters
ApiContinuationManager | null$manager

Reimplemented in ApiMain.

Definition at line 718 of file ApiBase.php.

References getMain().

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

◆ shouldCheckMaxlag()

ApiBase::shouldCheckMaxlag ( )

Indicates if this module needs maxlag to be checked.

Stability: stable
to override
Returns
bool

Reimplemented in ApiHelp.

Definition at line 403 of file ApiBase.php.

◆ useTransactionalTimeLimit()

◆ 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

Definition at line 1210 of file ApiBase.php.

References $params, getRequest(), ApiQueryTokens\getToken(), ApiQueryTokens\getTokenTypeSalts(), and getUser().

Member Data Documentation

◆ ALL_DEFAULT_STRING

const ApiBase::ALL_DEFAULT_STRING = '*'

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

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

Since
1.25

Definition at line 233 of file ApiBase.php.

◆ GET_VALUES_FOR_HELP

const ApiBase::GET_VALUES_FOR_HELP = 1

getAllowedParams() flag: When this is 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 249 of file ApiBase.php.

Referenced by ApiPageSet\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), and ApiUserrights\getAllowedParams().

◆ LIMIT_BIG1

const ApiBase::LIMIT_BIG1 = 500

Fast query, standard limit.

Definition at line 236 of file ApiBase.php.

Referenced by ApiQueryDeletedrevs\execute(), ApiQueryAllUsers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\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(), ApiQueryTags\getAllowedParams(), ApiQueryUserContribs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), and ApiQueryRevisionsBase\parseParameters().

◆ LIMIT_BIG2

const ApiBase::LIMIT_BIG2 = 5000

Fast query, apihighlimits limit.

Definition at line 238 of file ApiBase.php.

Referenced by ApiQueryDeletedrevs\execute(), ApiQueryAllUsers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\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(), ApiQueryTags\getAllowedParams(), ApiQueryUserContribs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), and ApiQueryRevisionsBase\parseParameters().

◆ LIMIT_SML1

const ApiBase::LIMIT_SML1 = 50

Slow query, standard limit.

Definition at line 240 of file ApiBase.php.

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

◆ LIMIT_SML2

const ApiBase::LIMIT_SML2 = 500

Slow query, apihighlimits limit.

Definition at line 242 of file ApiBase.php.

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

◆ PARAM_ALL

const ApiBase::PARAM_ALL = ParamValidator::PARAM_ALL
Deprecated:
since 1.35, use ParamValidator::PARAM_ALL instead

Definition at line 126 of file ApiBase.php.

◆ PARAM_ALLOW_DUPLICATES

const ApiBase::PARAM_ALLOW_DUPLICATES = ParamValidator::PARAM_ALLOW_DUPLICATES
Deprecated:
since 1.35, use ParamValidator::PARAM_ALLOW_DUPLICATES instead

Definition at line 106 of file ApiBase.php.

◆ PARAM_DEPRECATED

const ApiBase::PARAM_DEPRECATED = ParamValidator::PARAM_DEPRECATED
Deprecated:
since 1.35, use ParamValidator::PARAM_DEPRECATED instead

Definition at line 110 of file ApiBase.php.

◆ PARAM_DEPRECATED_VALUES

const ApiBase::PARAM_DEPRECATED_VALUES = EnumDef::PARAM_DEPRECATED_VALUES
Deprecated:
since 1.35, use EnumDef::PARAM_DEPRECATED_VALUES instead

Definition at line 138 of file ApiBase.php.

◆ PARAM_DFLT

const ApiBase::PARAM_DFLT = ParamValidator::PARAM_DEFAULT
Deprecated:
since 1.35, use ParamValidator::PARAM_DEFAULT instead

Definition at line 82 of file ApiBase.php.

◆ PARAM_EXTRA_NAMESPACES

const ApiBase::PARAM_EXTRA_NAMESPACES = NamespaceDef::PARAM_EXTRA_NAMESPACES
Deprecated:
since 1.35, use NamespaceDef::PARAM_EXTRA_NAMESPACES instead

Definition at line 130 of file ApiBase.php.

◆ PARAM_HELP_MSG

const ApiBase::PARAM_HELP_MSG = 'api-param-help-msg'

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

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

Since
1.25

Definition at line 171 of file ApiBase.php.

Referenced by ApiFeedWatchlist\getAllowedParams(), ApiImageRotate\getAllowedParams(), ApiPageSet\getAllowedParams(), ApiPurge\getAllowedParams(), ApiQuery\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiSetNotificationTimestamp\getAllowedParams(), ApiWatch\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiFeedRecentChanges\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(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryInfo\getAllowedParams(), ApiQueryCategoryMembers\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(), ApiQueryStashImageInfo\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryUserContribs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), and ApiQueryWatchlistRaw\getAllowedParams().

◆ PARAM_HELP_MSG_APPEND

◆ PARAM_HELP_MSG_INFO

const ApiBase::PARAM_HELP_MSG_INFO = 'api-param-help-msg-info'

(array) Specify additional information tags for the parameter.

The 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 188 of file ApiBase.php.

Referenced by ApiQueryAllDeletedRevisions\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryInfo\getAllowedParams(), and ApiQueryRevisions\getAllowedParams().

◆ PARAM_HELP_MSG_PER_VALUE

const ApiBase::PARAM_HELP_MSG_PER_VALUE = 'api-param-help-msg-per-value'

((string|array|Message)[]) When PARAM_TYPE is an array, or 'string' with PARAM_ISMULTI, this is an array mapping parameter values to help message specifiers (to be passed to ApiBase::makeMessage()) about those values.

When PARAM_TYPE is an array, any value not having a mapping will use the apihelp-{$path}-paramvalue-{$param}-{$value} message. (This means you can use an empty array to use the default message key for all values.)

Since
1.25
Note
Use with PARAM_TYPE = 'string' is allowed since 1.40.

Definition at line 211 of file ApiBase.php.

Referenced by ApiFeedWatchlist\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiComparePages\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiFormatJson\getAllowedParams(), ApiFormatPhp\getAllowedParams(), ApiMain\getAllowedParams(), ApiManageTags\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiParse\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryAllDeletedRevisions\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryAllRevisions\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryDeletedRevisions\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryFileRepoInfo\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryInfo\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryMyStashedFiles\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryUserContribs\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), and ApiQueryWatchlistRaw\getAllowedParams().

◆ PARAM_ISMULTI

const ApiBase::PARAM_ISMULTI = ParamValidator::PARAM_ISMULTI
Deprecated:
since 1.35, use ParamValidator::PARAM_ISMULTI instead

Definition at line 86 of file ApiBase.php.

◆ PARAM_ISMULTI_LIMIT1

const ApiBase::PARAM_ISMULTI_LIMIT1 = ParamValidator::PARAM_ISMULTI_LIMIT1
Deprecated:
since 1.35, use ParamValidator::PARAM_ISMULTI_LIMIT1 instead

Definition at line 142 of file ApiBase.php.

◆ PARAM_ISMULTI_LIMIT2

const ApiBase::PARAM_ISMULTI_LIMIT2 = ParamValidator::PARAM_ISMULTI_LIMIT2
Deprecated:
since 1.35, use ParamValidator::PARAM_ISMULTI_LIMIT2 instead

Definition at line 146 of file ApiBase.php.

◆ PARAM_MAX

const ApiBase::PARAM_MAX = IntegerDef::PARAM_MAX
Deprecated:
since 1.35, use IntegerDef::PARAM_MAX instead

Definition at line 94 of file ApiBase.php.

◆ PARAM_MAX2

const ApiBase::PARAM_MAX2 = IntegerDef::PARAM_MAX2
Deprecated:
since 1.35, use IntegerDef::PARAM_MAX2 instead

Definition at line 98 of file ApiBase.php.

◆ PARAM_MAX_BYTES

const ApiBase::PARAM_MAX_BYTES = StringDef::PARAM_MAX_BYTES
Deprecated:
since 1.35, use StringDef::PARAM_MAX_BYTES instead

Definition at line 150 of file ApiBase.php.

◆ PARAM_MAX_CHARS

const ApiBase::PARAM_MAX_CHARS = StringDef::PARAM_MAX_CHARS
Deprecated:
since 1.35, use StringDef::PARAM_MAX_CHARS instead

Definition at line 154 of file ApiBase.php.

◆ PARAM_MIN

const ApiBase::PARAM_MIN = IntegerDef::PARAM_MIN
Deprecated:
since 1.35, use IntegerDef::PARAM_MIN instead

Definition at line 102 of file ApiBase.php.

◆ PARAM_RANGE_ENFORCE

const ApiBase::PARAM_RANGE_ENFORCE = 'api-param-range-enforce'

(boolean) Inverse of IntegerDef::PARAM_IGNORE_RANGE

Deprecated:
since 1.35

Definition at line 161 of file ApiBase.php.

Referenced by ApiEditPage\getAllowedParams().

◆ PARAM_REQUIRED

const ApiBase::PARAM_REQUIRED = ParamValidator::PARAM_REQUIRED
Deprecated:
since 1.35, use ParamValidator::PARAM_REQUIRED instead

Definition at line 114 of file ApiBase.php.

◆ PARAM_SENSITIVE

const ApiBase::PARAM_SENSITIVE = ParamValidator::PARAM_SENSITIVE
Deprecated:
since 1.35, use ParamValidator::PARAM_SENSITIVE instead

Definition at line 134 of file ApiBase.php.

◆ PARAM_SUBMODULE_MAP

const ApiBase::PARAM_SUBMODULE_MAP = SubmoduleDef::PARAM_SUBMODULE_MAP
Deprecated:
since 1.35, use SubmoduleDef::PARAM_SUBMODULE_MAP instead

Definition at line 118 of file ApiBase.php.

◆ PARAM_SUBMODULE_PARAM_PREFIX

const ApiBase::PARAM_SUBMODULE_PARAM_PREFIX = SubmoduleDef::PARAM_SUBMODULE_PARAM_PREFIX
Deprecated:
since 1.35, use SubmoduleDef::PARAM_SUBMODULE_PARAM_PREFIX instead

Definition at line 122 of file ApiBase.php.

◆ PARAM_TEMPLATE_VARS

const ApiBase::PARAM_TEMPLATE_VARS = 'param-template-vars'

(array) Indicate that this is a templated parameter, and specify replacements.

Keys are the placeholders in the parameter name and values are the names of (unprefixed) parameters from which the replacement values are taken.

For example, a parameter "foo-{ns}-{title}" could be defined with PARAM_TEMPLATE_VARS => [ 'ns' => 'namespaces', 'title' => 'titles' ]. Then a query for namespaces=0|1&titles=X|Y would support parameters foo-0-X, foo-0-Y, foo-1-X, and foo-1-Y.

All placeholders must be present in the parameter's name. Each target parameter must have PARAM_ISMULTI true. If a target is itself a templated parameter, its PARAM_TEMPLATE_VARS must be a subset of the referring parameter's, mapping the same placeholders to the same targets. A parameter cannot target itself.

Since
1.32

Definition at line 229 of file ApiBase.php.

Referenced by ApiComparePages\getAllowedParams().

◆ PARAM_TYPE

const ApiBase::PARAM_TYPE = ParamValidator::PARAM_TYPE
Deprecated:
since 1.35, use ParamValidator::PARAM_TYPE instead

Definition at line 90 of file ApiBase.php.

◆ PARAM_VALUE_LINKS

const ApiBase::PARAM_VALUE_LINKS = 'api-param-value-links'

Deprecated and unused.

Since
1.25
Deprecated:
since 1.35

Definition at line 195 of file ApiBase.php.


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