MediaWiki  1.33.0
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, ApiCategoryTree, ApiChangeAuthenticationData, ApiCheckToken, ApiClearHasMsg, ApiClientLogin, ApiComparePages, ApiCSPReport, ApiDelete, ApiDisabled, ApiEditPage, ApiEmailUser, ApiExpandTemplates, ApiFancyCaptchaReload, ApiFeedContributions, ApiFeedRecentChanges, ApiFeedWatchlist, ApiFileRevert, ApiFormatBase, ApiHelp, ApiImageRotate, ApiImport, ApiLinkAccount, ApiLogin, ApiLogout, ApiMain, ApiManageTags, ApiMergeHistory, ApiMove, ApiOATHValidate, ApiOpenSearch, ApiOptions, ApiPageSet, ApiParamInfo, ApiParse, ApiPatrol, ApiProtect, ApiPurge, ApiQuery, ApiQueryBase, ApiQueryTitleBlacklist, ApiRemoveAuthenticationData, ApiResetPassword, ApiRevisionDelete, ApiRollback, ApiRsd, ApiSetNotificationTimestamp, ApiSetPageLanguage, ApiSpamBlacklist, ApiStashEdit, ApiTag, ApiTokens, ApiUnblock, ApiUndelete, ApiUpload, ApiUserrights, ApiValidatePassword, 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(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object. More...
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ( $key)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 

Public Attributes

string $mModulePrefix
 
const ALL_DEFAULT_STRING = '*'
 
const GET_VALUES_FOR_HELP = 1
 getAllowedParams() flag: When set, the result could take longer to generate, but should be more thorough. More...
 
const LIMIT_BIG1 = 500
 Fast query, standard limit. More...
 
const LIMIT_BIG2 = 5000
 Fast query, apihighlimits limit. More...
 
const LIMIT_SML1 = 50
 Slow query, standard limit. More...
 
const LIMIT_SML2 = 500
 Slow query, apihighlimits limit. More...
 
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. More...
 
const PARAM_ISMULTI = 1
 (boolean) Accept multiple pipe-separated values for this parameter (e.g. More...
 
const PARAM_TYPE = 2
 (string|string[]) Either an array of allowed value strings, or a string type as described below. More...
 
const PARAM_MAX = 3
 (integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'. More...
 
const PARAM_MAX2 = 4
 (integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'. More...
 
const PARAM_MIN = 5
 (integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'. More...
 
const PARAM_ALLOW_DUPLICATES = 6
 (boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true? More...
 
const PARAM_DEPRECATED = 7
 (boolean) Is the parameter deprecated (will show a warning)? More...
 
const PARAM_REQUIRED = 8
 (boolean) Is the parameter required? More...
 
const PARAM_RANGE_ENFORCE = 9
 (boolean) For PARAM_TYPE 'integer', enforce PARAM_MIN and PARAM_MAX? More...
 
const PARAM_HELP_MSG = 10
 (string|array|Message) Specify an alternative i18n documentation message for this parameter. More...
 
const PARAM_HELP_MSG_APPEND = 11
 ((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this parameter. More...
 
const PARAM_HELP_MSG_INFO = 12
 (array) Specify additional information tags for the parameter. More...
 
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. More...
 
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(). More...
 
const PARAM_SUBMODULE_MAP = 15
 (string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths. More...
 
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). More...
 
const PARAM_ALL = 17
 (boolean|string) When PARAM_TYPE has a defined set of values and PARAM_ISMULTI is true, this allows for an asterisk ('*') to be passed in place of a pipe-separated list of every possible value. More...
 
const PARAM_EXTRA_NAMESPACES = 18
 (int[]) When PARAM_TYPE is 'namespace', include these as additional possible values. More...
 
const PARAM_SENSITIVE = 19
 (boolean) Is the parameter sensitive? Note 'password'-type fields are always sensitive regardless of the value of this field. More...
 
const PARAM_DEPRECATED_VALUES = 20
 (array) When PARAM_TYPE is an array, this indicates which of the values are deprecated. More...
 
const PARAM_ISMULTI_LIMIT1 = 21
 (integer) Maximum number of values, for normal users. More...
 
const PARAM_ISMULTI_LIMIT2 = 22
 (integer) Maximum number of values, for users with the apihighimits right. More...
 
const PARAM_MAX_BYTES = 23
 (integer) Maximum length of a string in bytes (in UTF-8 encoding). More...
 
const PARAM_MAX_CHARS = 24
 (integer) Maximum length of a string in characters (unicode codepoints). More...
 
const PARAM_TEMPLATE_VARS = 25
 (array) Indicate that this is a templated parameter, and specify replacements. More...
 

Private Attributes

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

Static Private Attributes

static $blockMsgMap
 $var array Map of web UI block messages to corresponding API messages and codes More...
 
static array $extensionInfo = null
 Maps extension paths to info arrays. More...
 
static int[][][] $filterIDsCache = []
 Cache for self::filterIDs() More...
 

Methods to implement

 execute ()
 Evaluates the parameters, performs the requested query, and sets up the result. More...
 
 getModuleManager ()
 Get the module manager, or null if this module has no sub-modules. More...
 
 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. More...
 
 getHelpUrls ()
 Return links to more detailed help pages about the module. More...
 
 shouldCheckMaxlag ()
 Indicates if this module needs maxlag to be checked. More...
 
 isReadMode ()
 Indicates whether this module requires read rights. More...
 
 isWriteMode ()
 Indicates whether this module requires write mode. More...
 
 mustBePosted ()
 Indicates whether this module must be called with a POST request. More...
 
 isDeprecated ()
 Indicates whether this module is deprecated. More...
 
 isInternal ()
 Indicates whether this module is "internal" Internal API modules are not (yet) intended for 3rd party use and may be unstable. More...
 
 needsToken ()
 Returns the token type this module requires in order to execute. More...
 
 getConditionalRequestData ( $condition)
 Returns data for HTTP conditional request mechanisms. More...
 
 getExamplesMessages ()
 Returns usage examples for this module. More...
 
 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. More...
 
 getWebUITokenSalt (array $params)
 Fetch the salt used in the Web UI corresponding to this module. More...
 

Data access methods

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

Parameter handling

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

Utility methods

 getWatchlistUser ( $params)
 Gets the user for whom to get the watchlist. More...
 
 errorArrayToStatus (array $errors, User $user=null)
 Turn an array of message keys or key+param arrays into a Status. More...
 
 addBlockInfoToStatus (StatusValue $status, User $user=null)
 Add block info to block messages in a Status. More...
 
 setWatch ( $watch, $titleObj, $userOption=null)
 Set a watch (or unwatch) based the based on a watchlist parameter. More...
 
 useTransactionalTimeLimit ()
 Call wfTransactionalTimeLimit() if this request was POSTed. More...
 
 filterIDs ( $fields, array $ids)
 Filter out-of-range values from a list of positive integer IDs. More...
 
static makeMessage ( $msg, IContextSource $context, array $params=null)
 Create a Message from a string or array. More...
 

Warning and error reporting

 addWarning ( $msg, $code=null, $data=null)
 Add a warning for this module. More...
 
 addDeprecation ( $msg, $feature, $data=[])
 Add a deprecation warning for this module. More...
 
 addError ( $msg, $code=null, $data=null)
 Add an error for this module without aborting. More...
 
 addMessagesFromStatus (StatusValue $status, $types=[ 'warning', 'error'], array $filter=[])
 Add warnings and/or errors from a Status. More...
 
 dieWithError ( $msg, $code=null, $data=null, $httpCode=null)
 Abort execution with an error. More...
 
 dieWithException ( $exception, array $options=[])
 Abort execution with an error derived from an exception. More...
 
 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. More...
 
 dieStatus (StatusValue $status)
 Throw an ApiUsageException based on the Status object. More...
 
 dieReadOnly ()
 Helper function for readonly errors. More...
 
 checkUserRightsAny ( $rights, $user=null)
 Helper function for permission-denied errors. More...
 
 checkTitleUserPermissions (Title $title, $actions, $options=[])
 Helper function for permission-denied errors. More...
 
 dieWithErrorOrDebug ( $msg, $code=null, $data=null, $httpCode=null)
 Will only set a warning instead of failing if the global $wgDebugAPI is set to true. More...
 
 logFeatureUsage ( $feature)
 Write logging information for API features to a debug log, for usage analysis. More...
 
 dieContinueUsageIf ( $condition)
 Die with the 'badcontinue' error. More...
 
 warnOrDie (ApiMessage $msg, $enforceLimits=false)
 Adds a warning to the output, else dies. More...
 
static dieDebug ( $method, $message)
 Internal code errors should be reported with this method. More...
 

Help message generation

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

Deprecated

 getDescription ()
 Returns the description string for this module. More...
 
 getParamDescription ()
 Returns an array of parameter descriptions. More...
 
 getExamples ()
 Returns usage examples for this module. More...
 
 getDescriptionMessage ()
 Return the description message. More...
 
static truncateArray (&$arr, $limit)
 Truncate an array to a certain length. More...
 

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 37 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 ApiComparePages, and ApiOpenSearchFormatJson.

Definition at line 295 of file ApiBase.php.

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

Member Function Documentation

◆ addBlockInfoToStatus()

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

Add block info to block messages in a Status.

Since
1.33
Parameters
StatusValue$status
User | null$user

Definition at line 1829 of file ApiBase.php.

References $code, $user, as, ApiMessage\create(), ApiQueryUserInfo\getBlockInfo(), ContextSource\getUser(), and list.

Referenced by dieStatus().

◆ addDeprecation()

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

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

References $code, $data, getErrorFormatter(), and getModulePath().

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

References $filter, getErrorFormatter(), and getModulePath().

Referenced by ApiDelete\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 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()

Reimplemented in MockApi.

Definition at line 1909 of file ApiBase.php.

References $code, $data, getErrorFormatter(), and getModulePath().

Referenced by addDeprecation(), dieWithErrorOrDebug(), ApiTokens\execute(), ApiCheckToken\execute(), ApiPurge\execute(), ApiExpandTemplates\execute(), ApiQueryTokens\execute(), ApiParamInfo\execute(), ApiQueryDisabled\execute(), ApiOptions\execute(), ApiParse\execute(), ApiComparePages\execute(), ApiQueryUsers\execute(), ApiPageSet\executeInternal(), ApiQueryRevisionsBase\extractDeprecatedContent(), ApiQueryInfo\extractPageInfo(), extractRequestParams(), ApiQueryRecentChanges\extractRowInfo(), ApiComparePages\getDiffRevision(), ApiMain\getVal(), ApiMain\handleException(), handleParamNormalization(), ApiQueryImageInfo\mergeThumbParams(), parseMultiValue(), ApiQueryRevisionsBase\parseParameters(), ApiMain\printResult(), ApiMain\reportUnusedParams(), ApiQueryAllDeletedRevisions\run(), ApiQueryImages\run(), ApiQueryCategories\run(), ApiQueryLinks\run(), ApiQueryRevisions\run(), and warnOrDie().

◆ checkTitleUserPermissions()

ApiBase::checkTitleUserPermissions ( Title  $title,
  $actions,
  $options = [] 
)

Helper function for permission-denied errors.

Since
1.29
1.33 Changed the third parameter from $user to $options.
Parameters
Title$title
string | string[]$actions
array$optionsAdditional options
  • user: (User) User to use rather than $this->getUser()
  • autoblock: (bool, default false) Whether to spread autoblocks For compatibility, passing a User object is treated as the value for the 'user' option.
Exceptions
ApiUsageExceptionif the user doesn't have all of the rights.

Definition at line 2127 of file ApiBase.php.

References $options, $title, $user, array(), as, dieStatus(), errorArrayToStatus(), ContextSource\getUser(), and wfDeprecated().

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

◆ checkUserRightsAny()

ApiBase::checkUserRightsAny (   $rights,
  $user = null 
)

Helper function for permission-denied errors.

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

Definition at line 2105 of file ApiBase.php.

References $user, array(), dieWithError(), ContextSource\getUser(), and ContextSource\msg().

Referenced by ApiOATHValidate\execute(), ApiWatch\execute(), ApiQueryOATH\execute(), ApiRevisionDelete\execute(), ApiTag\execute(), ApiSetNotificationTimestamp\execute(), ApiBlock\execute(), ApiQueryDeletedrevs\execute(), ApiOptions\execute(), ApiQueryFilearchive\execute(), ApiSetPageLanguage\execute(), getWatchlistUser(), ApiQueryDeletedRevisions\run(), and ApiQueryAllDeletedRevisions\run().

◆ 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

Definition at line 2030 of file ApiBase.php.

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

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

◆ dieContinueUsageIf()

◆ dieDebug()

◆ dieReadOnly()

ApiBase::dieReadOnly ( )

Helper function for readonly errors.

Exceptions
ApiUsageExceptionalways

Definition at line 2089 of file ApiBase.php.

References dieWithError(), and wfReadOnlyReason().

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

◆ dieStatus()

◆ dieWithError()

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

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 | null$httpCodeHTTP error code to use
Exceptions
ApiUsageExceptionalways

Definition at line 1990 of file ApiBase.php.

References $code, $data, and ApiUsageException\newWithMessage().

Referenced by ApiMain\checkAsserts(), ApiMain\checkBotReadOnly(), ApiMain\checkExecutePermissions(), ApiMain\checkMaxLag(), ApiQueryImageInfo\checkParameterNormalise(), ApiUpload\checkPermissions(), checkUserRightsAny(), ApiUpload\checkVerification(), ApiMain\createPrinterByName(), dieBlocked(), dieContinueUsageIf(), dieReadOnly(), dieWithErrorOrDebug(), dieWithException(), ApiCSPReport\error(), ApiValidatePassword\execute(), ApiCategoryTree\execute(), ApiOATHValidate\execute(), ApiProtect\execute(), ApiManageTags\execute(), ApiUndelete\execute(), ApiEmailUser\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiImport\execute(), ApiWatch\execute(), ApiUpload\execute(), ApiEditPage\execute(), ApiLogout\execute(), ApiQueryOATH\execute(), ApiExpandTemplates\execute(), ApiQueryExternalLinks\execute(), ApiQueryStashImageInfo\execute(), ApiRevisionDelete\execute(), ApiUnblock\execute(), ApiDisabled\execute(), ApiQueryMyStashedFiles\execute(), ApiQueryAllMessages\execute(), ApiQueryTitleBlacklist\execute(), ApiFormatPhp\execute(), ApiQueryLangLinks\execute(), ApiChangeAuthenticationData\execute(), ApiSetNotificationTimestamp\execute(), ApiPatrol\execute(), ApiDelete\execute(), ApiQueryBlocks\execute(), ApiQueryIWLinks\execute(), ApiBlock\execute(), ApiQueryDeletedrevs\execute(), ApiOptions\execute(), ApiQueryReferences\execute(), ApiQueryFilearchive\execute(), ApiParse\execute(), ApiFeedRecentChanges\execute(), ApiQueryImageInfo\execute(), ApiQueryLogEvents\execute(), ApiQueryUserContribs\execute(), ApiComparePages\execute(), ApiFeedContributions\execute(), ApiRemoveAuthenticationData\execute(), ApiSetPageLanguage\execute(), ApiFeedWatchlist\execute(), ApiUserrights\execute(), ApiAMCreateAccount\execute(), ApiLinkAccount\execute(), ApiStashEdit\execute(), ApiClientLogin\execute(), ApiResetPassword\execute(), ApiOpenSearchFormatJson\execute(), ApiQueryAllPages\executeGenerator(), ApiQueryAllImages\executeGenerator(), ApiPageSet\executeInternal(), ApiQueryRevisionsBase\extractAllSlotInfo(), ApiUpload\getChunkResult(), ApiUpload\getContextResult(), ApiComparePages\getDiffRevision(), ApiFeedRecentChanges\getFeedObject(), getModuleFromPath(), getParameterFromSettings(), ApiParse\getParsedContent(), ApiRollback\getRbTitle(), ApiRollback\getRbUser(), ApiParse\getSectionContent(), getTitleFromTitleOrPageId(), getTitleOrPageId(), getWatchlistUser(), ApiQueryImageInfo\mergeThumbParams(), ApiQuery\outputGeneralPageInfo(), parseMultiValue(), ApiQueryRevisionsBase\parseParameters(), ApiUpload\performUpload(), ApiQueryBase\prefixedTitlePartToKey(), ApiQueryUserContribs\prepareQuery(), ApiQueryBase\prepareUrlQuerySearchString(), ApiQueryBlocks\prepareUsername(), requireAtLeastOneParameter(), requireMaxOneParameter(), requireOnlyOneParameter(), requirePostedParameters(), ApiQueryAllDeletedRevisions\run(), ApiQueryIWBacklinks\run(), ApiQueryExtLinksUsage\run(), ApiQueryLangBacklinks\run(), ApiQueryCategories\run(), ApiQueryWatchlistRaw\run(), ApiQuerySearch\run(), ApiQueryAllPages\run(), ApiQueryCategoryMembers\run(), ApiQueryWatchlist\run(), ApiQueryAllImages\run(), ApiQueryQueryPage\run(), ApiQueryRevisions\run(), ApiQueryBacklinksprop\run(), ApiQueryAllLinks\run(), ApiQueryRecentChanges\run(), ApiUpload\selectUploadModule(), ApiMain\setupExternalResponse(), ApiMain\setupModule(), ApiQueryBase\titlePartToKey(), ApiFileRevert\validateParameters(), validateTimestamp(), validateUser(), and warnOrDie().

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

References $code, $data, addWarning(), dieWithError(), and ContextSource\getConfig().

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

◆ dieWithException()

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

Abort execution with an error derived from an exception.

Since
1.29
Parameters
Exception | Throwable$exceptionSee ApiErrorFormatter::getMessageFromException()
array$optionsSee ApiErrorFormatter::getMessageFromException()
Exceptions
ApiUsageExceptionalways

Definition at line 2002 of file ApiBase.php.

References $options, dieWithError(), and getErrorFormatter().

Referenced by ApiImport\execute(), ApiEditPage\execute(), ApiQueryStashImageInfo\execute(), ApiParse\execute(), and ApiComparePages\getDiffRevision().

◆ 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, ApiClientLogin, ApiLinkAccount, and ApiChangeAuthenticationData.

Definition at line 710 of file ApiBase.php.

◆ encodeParamName()

◆ errorArrayToStatus()

ApiBase::errorArrayToStatus ( array  $errors,
User  $user = null 
)

◆ 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 ApiMain, ApiOpenSearchFormatJson, ApiQueryInfo, ApiQuery, ApiPageSet, ApiQueryRecentChanges, ApiQueryBacklinks, ApiQueryUsers, ApiFormatFeedWrapper, ApiFormatRaw, ApiOpenSearch, ApiQueryBacklinksprop, ApiQueryAllLinks, ApiLogin, ApiQueryRevisionsBase, ApiQueryLinks, ApiFormatJson, ApiQueryAllImages, ApiResetPassword, ApiQueryGadgets, ApiQueryQueryPage, ApiClientLogin, ApiStashEdit, ApiAMCreateAccount, ApiLinkAccount, ApiUserrights, ApiFeedWatchlist, ApiQueryContributors, ApiFeedContributions, ApiRemoveAuthenticationData, ApiSetPageLanguage, ApiComparePages, ApiFeedRecentChanges, ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryUserContribs, ApiQueryAllUsers, ApiQueryFileRepoInfo, ApiCSPReport, ApiParse, ApiQueryUserInfo, ApiQueryWatchlist, ApiQueryReferences, ApiQueryFilearchive, ApiQueryPagePropNames, ApiQuerySearch, ApiOptions, ApiQueryDeletedrevs, ApiRollback, ApiQueryGadgetCategories, ApiBlock, ApiDelete, ApiQueryAuthManagerInfo, ApiQueryBlocks, ApiQueryIWLinks, ApiQueryWatchlistRaw, ApiQueryTitleBlacklist, ApiChangeAuthenticationData, ApiFileRevert, ApiFormatPhp, ApiPatrol, ApiQueryAllMessages, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiQueryLangLinks, ApiQueryPageProps, ApiQueryPagesWithProp, ApiQueryPrefixSearch, ApiSetNotificationTimestamp, ApiDisabled, ApiParamInfo, ApiQueryAllCategories, ApiQueryAllPages, ApiQueryCategoryInfo, ApiQueryDisabled, ApiQueryImages, ApiQueryMyStashedFiles, ApiQueryOATH, ApiExpandTemplates, ApiFormatNone, ApiQueryCategories, ApiQueryCategoryMembers, ApiQueryDuplicateFiles, ApiQueryExternalLinks, ApiQueryProtectedTitles, ApiQueryRandom, ApiQueryStashImageInfo, ApiQueryTags, ApiQueryTokens, ApiRevisionDelete, ApiTag, ApiUnblock, ApiSpamBlacklist, ApiEditPage, ApiHelp, ApiLogout, ApiPurge, ApiQueryExtLinksUsage, ApiRsd, ApiUpload, ApiCheckToken, ApiWatch, ApiImport, ApiClearHasMsg, ApiEmailUser, ApiMergeHistory, ApiMove, ApiTokens, ApiManageTags, ApiUndelete, ApiProtect, ApiOATHValidate, ApiImageRotate, ApiCategoryTree, ApiValidatePassword, ApiFancyCaptchaReload, 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 1448 of file ApiBase.php.

References $value.

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

◆ extractRequestParams()

ApiBase::extractRequestParams (   $options = [])

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

References $name, $options, $params, $ret, $value, addWarning(), as, encodeParamName(), getFinalParams(), getParameterFromSettings(), list, PARAM_TEMPLATE_VARS, and wfEscapeWikiText().

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

◆ filterIDs()

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

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

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

Definition at line 1861 of file ApiBase.php.

References as, getDB(), list, and use.

Referenced by ApiQueryBase\addWhereIDsFld(), ApiPageSet\initFromPageIds(), and ApiPageSet\initFromRevIDs().

◆ 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 ApiMain, ApiQueryInfo, ApiHelp, ApiUpload, ApiParse, ApiQueryRecentChanges, ApiQueryImageInfo, ApiQueryRevisionsBase, ApiQueryUserContribs, ApiComparePages, ApiParamInfo, ApiEditPage, ApiQueryBacklinks, ApiStashEdit, ApiQueryRevisions, ApiQueryDeletedrevs, ApiQueryWatchlist, ApiQueryAllDeletedRevisions, ApiQueryUsers, ApiFormatBase, ApiQueryBacklinksprop, ApiQuerySearch, ApiQueryAllUsers, ApiQueryUserInfo, ApiQueryBlocks, ApiQueryAllImages, ApiQueryCategoryMembers, ApiOpenSearch, ApiQueryDeletedRevisions, ApiQueryAllRevisions, ApiQueryAllPages, ApiLogin, ApiQueryAllLinks, ApiMove, ApiQueryFilearchive, ApiQueryContributors, ApiQueryAllMessages, ApiCSPReport, ApiFeedContributions, ApiOptions, ApiQueryExtLinksUsage, ApiQueryLinks, ApiDelete, ApiExpandTemplates, ApiQueryGadgets, ApiQueryProtectedTitles, ApiQueryRandom, ApiQueryCategories, ApiBlock, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiQueryQueryPage, ApiUserrights, ApiQueryDuplicateFiles, ApiRevisionDelete, ApiQueryAllCategories, ApiQueryIWLinks, ApiTag, ApiQueryExternalLinks, ApiQueryLangLinks, ApiImport, ApiProtect, ApiQueryImages, ApiQueryWatchlistRaw, ApiQueryPagesWithProp, ApiQueryTags, ApiFeedRecentChanges, ApiFormatJson, ApiCategoryTree, ApiQueryMyStashedFiles, ApiClientLogin, ApiAMCreateAccount, ApiLinkAccount, ApiRollback, ApiSetPageLanguage, ApiFileRevert, ApiMergeHistory, ApiQueryTokens, ApiQueryPrefixSearch, ApiUndelete, ApiQueryPageProps, ApiUnblock, ApiQueryAuthManagerInfo, ApiQueryCategoryInfo, ApiResetPassword, ApiTokens, ApiRemoveAuthenticationData, ApiPatrol, ApiEmailUser, ApiManageTags, ApiQueryPagePropNames, ApiOATHValidate, ApiQueryGadgetCategories, ApiQueryStashImageInfo, ApiQueryTitleBlacklist, ApiChangeAuthenticationData, ApiFormatPhp, ApiQueryFileRepoInfo, ApiQueryOATH, ApiCheckToken, ApiValidatePassword, ApiSpamBlacklist, ApiQueryDisabled, ApiQueryReferences, ApiFancyCaptchaReload, and MockApi.

Definition at line 386 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.

Reimplemented in ApiCategoryTree.

Definition at line 497 of file ApiBase.php.

◆ getContinuationManager()

ApiBase::getContinuationManager ( )

Get the continuation manager.

Returns
ApiContinuationManager|null

Reimplemented in ApiMain.

Definition at line 672 of file ApiBase.php.

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

Referenced by ApiQueryAllRevisions\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryGeneratorBase\setContinueEnumParameter(), and ApiQueryBase\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 ApiHelp, ApiQuery, ApiOpenSearch, ApiRsd, ApiFeedContributions, ApiFeedWatchlist, and ApiFeedRecentChanges.

Definition at line 346 of file ApiBase.php.

◆ getDB()

ApiBase::getDB ( )
protected

Gets a default replica DB connection object.

Returns
IDatabase

Reimplemented in ApiPageSet, ApiQueryBase, and ApiQueryAllImages.

Definition at line 660 of file ApiBase.php.

References $mReplicaDB, DB_REPLICA, and wfGetDB().

Referenced by ApiQuery\doExport(), filterIDs(), ApiParse\formatCategoryLinks(), ApiComparePages\getRevisionById(), 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|false

Definition at line 2624 of file ApiBase.php.

References wfDeprecated().

◆ getDescriptionMessage()

ApiBase::getDescriptionMessage ( )
protected

Return the description message.

This is additional text to display on the help page after the summary.

Deprecated:
since 1.30
Returns
string|array|Message

Definition at line 2675 of file ApiBase.php.

References wfDeprecated().

◆ getErrorFormatter()

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

References wfDeprecated().

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

Definition at line 361 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
Returns
string|array|Message

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

Definition at line 2257 of file ApiBase.php.

Referenced by getFinalDescription().

◆ 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 ApiClientLogin, ApiAMCreateAccount, and ApiLinkAccount.

Definition at line 2286 of file ApiBase.php.

References ContextSource\getContext(), getExtendedDescription(), getModuleName(), getModulePath(), getModulePrefix(), getSummaryMessage(), makeMessage(), and Hooks\run().

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

References $name, $params, $path, $value, as, dieDebug(), ContextSource\getContext(), getFinalParams(), getModuleFromPath(), getModuleManager(), getModuleName(), getModulePath(), getModulePrefix(), isMain(), makeMessage(), ContextSource\msg(), PARAM_DEPRECATED_VALUES, PARAM_HELP_MSG, PARAM_HELP_MSG_PER_VALUE, PARAM_SUBMODULE_MAP, and Hooks\run().

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

References $params, getAllowedParams(), needsToken(), and Hooks\run().

Referenced by extractRequestParams(), and getFinalParamDescription().

◆ getFinalSummary()

ApiBase::getFinalSummary ( )

Get final module summary.

Since
1.30
Returns
Message

Definition at line 2270 of file ApiBase.php.

References ContextSource\getContext(), getModuleName(), getModulePath(), getModulePrefix(), getSummaryMessage(), and makeMessage().

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

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

Definition at line 370 of file ApiBase.php.

◆ getMain()

ApiBase::getMain ( )

Get the main module.

Returns
ApiMain

Definition at line 528 of file ApiBase.php.

References $mMainModule.

Referenced by ApiFormatJson\__construct(), ApiFormatBase\__construct(), ApiQueryBase\__construct(), ApiContinuationManager\__construct(), ApiPageSet\__construct(), addDeprecation(), ApiFormatBase\closePrinter(), ApiCategoryTree\execute(), ApiUpload\execute(), ApiHelp\execute(), ApiEditPage\execute(), ApiExpandTemplates\execute(), ApiParamInfo\execute(), ApiQueryGadgetCategories\execute(), ApiQueryDeletedrevs\execute(), ApiParse\execute(), ApiFeedRecentChanges\execute(), ApiComparePages\execute(), ApiFeedWatchlist\execute(), ApiQueryGadgets\execute(), ApiOpenSearch\execute(), ApiQuery\execute(), ApiPageSet\executeInternal(), ApiQueryInfo\extractPageInfo(), ApiParamInfo\getAllowedParams(), ApiUpload\getChunkResult(), getContinuationManager(), ApiQueryUserInfo\getCurrentUserInfo(), ApiFeedRecentChanges\getCustomPrinter(), ApiFeedWatchlist\getCustomPrinter(), ApiFeedContributions\getCustomPrinter(), ApiRsd\getCustomPrinter(), ApiOpenSearch\getCustomPrinter(), ApiQuery\getCustomPrinter(), ApiHelp\getCustomPrinter(), getErrorFormatter(), ApiPageSet\getGenerators(), getModuleFromPath(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), getParent(), getResult(), ApiFeedWatchlist\getWatchlistModule(), ApiFormatRaw\initPrinter(), ApiFormatBase\initPrinter(), lacksSameOriginSecurity(), logFeatureUsage(), ApiQueryRevisionsBase\parseParameters(), requirePostedParameters(), ApiQuerySearch\run(), ApiQueryRandom\run(), ApiUpload\selectUploadModule(), setContinuationManager(), ApiFormatBase\setHttpStatus(), ApiComparePages\setVals(), and validateLimit().

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

References $parent, $path, captcha-old\count, dieWithError(), getMain(), and wfEscapeWikiText().

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

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

Referenced by ApiParamInfo\execute(), getFinalParamDescription(), 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 512 of file ApiBase.php.

References $mModuleName.

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

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

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

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

References wfDeprecated().

◆ getParameter()

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

◆ 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$parseLimitWhether to parse and validate 'limit' parameters
Returns
mixed Parameter value

Reimplemented in ApiFormatBase.

Definition at line 1122 of file ApiBase.php.

References $name, $request, $type, $value, addDeprecation(), ALL_DEFAULT_STRING, array(), as, ChangeTags\canAddTagsAccompanyingChange(), dieDebug(), dieStatus(), dieWithError(), encodeParamName(), getMain(), getModuleManager(), getModuleName(), getResult(), MWNamespace\getValidNamespaces(), handleParamNormalization(), PARAM_ALL, PARAM_ALLOW_DUPLICATES, PARAM_DEPRECATED, PARAM_DEPRECATED_VALUES, PARAM_DFLT, PARAM_ISMULTI, PARAM_ISMULTI_LIMIT1, PARAM_ISMULTI_LIMIT2, PARAM_MAX, PARAM_MAX2, PARAM_MIN, PARAM_RANGE_ENFORCE, PARAM_REQUIRED, PARAM_TYPE, parseMultiValue(), validateLimit(), validateTimestamp(), and validateUser().

Referenced by extractRequestParams().

◆ getParent()

ApiBase::getParent ( )

Get the parent of this module.

Since
1.25
Returns
ApiBase|null

Reimplemented in ApiQueryBase.

Definition at line 546 of file ApiBase.php.

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

Referenced by getModulePath().

◆ getResult()

ApiBase::getResult ( )

Get the result object.

Returns
ApiResult

Reimplemented in ApiMain.

Definition at line 632 of file ApiBase.php.

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

Referenced by ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiQueryGadgets\applyList(), ApiFormatRaw\closePrinter(), ApiFormatBase\closePrinter(), ApiFancyCaptchaReload\execute(), ApiValidatePassword\execute(), ApiCategoryTree\execute(), ApiImageRotate\execute(), ApiOATHValidate\execute(), ApiProtect\execute(), ApiManageTags\execute(), ApiUndelete\execute(), ApiEmailUser\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiTokens\execute(), ApiClearHasMsg\execute(), ApiImport\execute(), ApiWatch\execute(), ApiCheckToken\execute(), ApiRsd\execute(), ApiUpload\execute(), ApiSpamBlacklist\execute(), ApiHelp\execute(), ApiEditPage\execute(), ApiPurge\execute(), ApiExpandTemplates\execute(), ApiQueryStashImageInfo\execute(), ApiQueryTags\execute(), ApiQueryTokens\execute(), ApiRevisionDelete\execute(), ApiTag\execute(), ApiUnblock\execute(), ApiQueryOATH\execute(), ApiQueryMyStashedFiles\execute(), ApiParamInfo\execute(), ApiQueryTitleBlacklist\execute(), ApiQueryPageProps\execute(), ApiChangeAuthenticationData\execute(), ApiPatrol\execute(), ApiSetNotificationTimestamp\execute(), ApiFileRevert\execute(), ApiQueryAllMessages\execute(), ApiFormatPhp\execute(), ApiQueryBlocks\execute(), ApiDelete\execute(), ApiBlock\execute(), ApiQueryAuthManagerInfo\execute(), ApiQueryDeletedrevs\execute(), ApiRollback\execute(), ApiOptions\execute(), ApiQueryFilearchive\execute(), ApiQueryPagePropNames\execute(), ApiQueryUserInfo\execute(), ApiCSPReport\execute(), ApiParse\execute(), ApiQueryFileRepoInfo\execute(), ApiQueryAllUsers\execute(), ApiQueryLogEvents\execute(), ApiFeedRecentChanges\execute(), ApiQueryUserContribs\execute(), ApiQueryImageInfo\execute(), ApiComparePages\execute(), ApiSetPageLanguage\execute(), ApiFeedContributions\execute(), ApiRemoveAuthenticationData\execute(), ApiFeedWatchlist\execute(), ApiQueryContributors\execute(), ApiUserrights\execute(), ApiLinkAccount\execute(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiStashEdit\execute(), ApiResetPassword\execute(), ApiFormatJson\execute(), ApiLogin\execute(), ApiFormatRaw\execute(), ApiFormatFeedWrapper\execute(), ApiQueryUsers\execute(), ApiQuery\execute(), ApiQueryInfo\execute(), ApiOpenSearchFormatJson\execute(), ApiFormatRaw\getFilename(), ApiQueryGadgetCategories\getList(), ApiFormatRaw\getMimeType(), getParameterFromSettings(), ApiFormatRaw\initPrinter(), ApiFormatFeedWrapper\initPrinter(), ApiQuery\outputGeneralPageInfo(), ApiQueryRevisionsBase\parseParameters(), ApiOpenSearch\populateResult(), ApiQueryAllRevisions\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryProtectedTitles\run(), ApiQueryPrefixSearch\run(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryExtLinksUsage\run(), ApiQueryWatchlistRaw\run(), ApiQueryAllCategories\run(), ApiQuerySearch\run(), ApiQueryPagesWithProp\run(), ApiQueryCategoryMembers\run(), ApiQueryAllPages\run(), ApiQueryWatchlist\run(), ApiQueryAllImages\run(), ApiQueryQueryPage\run(), ApiQueryAllLinks\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryRandom\runQuery(), ApiUpload\selectUploadModule(), and ApiQueryGadgets\setIndexedTagNameForMetadata().

◆ 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
Returns
string|array|Message

Reimplemented in ApiDisabled, and ApiQueryDisabled.

Definition at line 2244 of file ApiBase.php.

Referenced by getFinalDescription(), and getFinalSummary().

◆ getTitleFromTitleOrPageId()

ApiBase::getTitleFromTitleOrPageId (   $params)

Get a Title 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.

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

Definition at line 1053 of file ApiBase.php.

References $params, dieWithError(), Title\newFromID(), Title\newFromText(), requireOnlyOneParameter(), and wfEscapeWikiText().

◆ 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$paramsUser provided set of parameters, as from $this->extractRequestParams()
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 1016 of file ApiBase.php.

References $params, dieWithError(), WikiPage\factory(), WikiPage\newFromID(), Title\newFromText(), requireOnlyOneParameter(), and wfEscapeWikiText().

Referenced by ApiProtect\execute(), ApiEditPage\execute(), ApiDelete\execute(), ApiParse\execute(), ApiSetPageLanguage\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 1741 of file ApiBase.php.

References $params, $user, checkUserRightsAny(), dieWithError(), ContextSource\getUser(), User\newFromName(), and wfEscapeWikiText().

Referenced by ApiQueryWatchlistRaw\run(), and ApiQueryWatchlist\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 | null$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 1081 of file ApiBase.php.

References ContextSource\getUser(), and User\IGNORE_USER_RIGHTS.

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, and ApiLogout.

Definition at line 481 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 1436 of file ApiBase.php.

References addWarning(), and encodeParamName().

Referenced by getParameterFromSettings().

◆ isDeprecated()

ApiBase::isDeprecated ( )

Indicates whether this module is deprecated.

Since
1.25
Returns
bool

Reimplemented in ApiQueryDeletedrevs, ApiLogin, and ApiTokens.

Definition at line 436 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 ApiStashEdit, ApiCSPReport, ApiCategoryTree, ApiOATHValidate, and ApiQueryOATH.

Definition at line 446 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 537 of file ApiBase.php.

References $mMainModule.

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

◆ isReadMode()

ApiBase::isReadMode ( )

Indicates whether this module requires read rights.

Returns
bool

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

Definition at line 404 of file ApiBase.php.

Referenced by getHelpFlags().

◆ 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 master database access, since only read queries are needed and each master 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.

Returns
bool

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

Definition at line 419 of file ApiBase.php.

Referenced by getHelpFlags(), and ApiMain\setRequestExpectations().

◆ lacksSameOriginSecurity()

ApiBase::lacksSameOriginSecurity ( )

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

References $request, $s, getMain(), ContextSource\getRequest(), ContextSource\getUser(), string, wfDebugLog(), and wfUrlencode().

Referenced by addDeprecation().

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

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

Referenced by ApiAMCreateAccount\getFinalDescription(), ApiLinkAccount\getFinalDescription(), ApiClientLogin\getFinalDescription(), getFinalDescription(), getFinalParamDescription(), getFinalSummary(), 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 2605 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.

Returns
string|false

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

Definition at line 468 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 1001 of file ApiBase.php.

◆ parseMultiValue()

ApiBase::parseMultiValue (   $valueName,
  $value,
  $allowMultiple,
  $allowedValues,
  $allSpecifier = null,
  $limit1 = null,
  $limit2 = null 
)
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.
string | null$allSpecifierString to use to specify all allowed values, or null if this behavior should not be allowed
int | null$limit1Maximum number of values, for normal users.
int | null$limit2Maximum number of values, for users with the apihighlimits right.
Returns
string|string[] (allowMultiple ? an_array_of_values : a_single_value)

Definition at line 1476 of file ApiBase.php.

References $value, addWarning(), captcha-old\count, dieWithError(), explodeMultiValue(), LIMIT_SML1, LIMIT_SML2, and wfEscapeWikiText().

Referenced by getParameterFromSettings().

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

References $params, captcha-old\count, dieWithError(), and encodeParamName().

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

◆ requireMaxOneParameter()

ApiBase::requireMaxOneParameter (   $params,
  $required 
)

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

References $params, captcha-old\count, dieWithError(), and encodeParamName().

Referenced by ApiMergeHistory\execute(), ApiMove\execute(), ApiUnblock\execute(), ApiPatrol\execute(), ApiBlock\execute(), ApiQueryUserContribs\execute(), ApiStashEdit\execute(), ApiResetPassword\execute(), ApiRollback\getRbTitle(), getTitleFromTitleOrPageId(), 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 971 of file ApiBase.php.

References $params, as, captcha-old\count, dieWithError(), encodeParamName(), ContextSource\getConfig(), getMain(), and ContextSource\getRequest().

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

◆ setContinuationManager()

ApiBase::setContinuationManager ( ApiContinuationManager  $manager = null)

Set the continuation manager.

Parameters
ApiContinuationManager | null$manager

Reimplemented in ApiMain.

Definition at line 686 of file ApiBase.php.

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

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

◆ 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 | null$userOptionThe user option to consider when $watch=preferences

Definition at line 1726 of file ApiBase.php.

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

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

◆ shouldCheckMaxlag()

ApiBase::shouldCheckMaxlag ( )

Indicates if this module needs maxlag to be checked.

Returns
bool

Reimplemented in ApiHelp.

Definition at line 396 of file ApiBase.php.

◆ truncateArray()

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

Truncate an array to a certain length.

Deprecated:
since 1.32, no replacement
Parameters
array&$arrArray to truncate
int$limitMaximum length
Returns
bool True if the array was truncated, false otherwise

Definition at line 2690 of file ApiBase.php.

References captcha-old\count, and wfDeprecated().

◆ 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 | null$botMaxMaximum value for sysops/bots
bool$enforceLimitsWhether to enforce (die) if value is outside limits

Definition at line 1557 of file ApiBase.php.

References $value, ApiMessage\create(), encodeParamName(), getMain(), and warnOrDie().

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

◆ validateTimestamp()

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

Validate and normalize parameters of type 'timestamp'.

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

Definition at line 1610 of file ApiBase.php.

References $value, addDeprecation(), dieWithError(), wfEscapeWikiText(), 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 1647 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 parameters of type 'user'.

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

Definition at line 1682 of file ApiBase.php.

References $name, $value, dieWithError(), User\getCanonicalName(), ExternalUserNames\isExternal(), IP\isIPAddress(), User\newFromName(), RE_IP_BYTE, IP\sanitizeIP(), and wfEscapeWikiText().

Referenced by getParameterFromSettings().

◆ warnOrDie()

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

Adds a warning to the output, else dies.

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

Definition at line 2014 of file ApiBase.php.

References addWarning(), and dieWithError().

Referenced by validateLimit().

Member Data Documentation

◆ $blockMsgMap

ApiBase::$blockMsgMap
staticprivate
Initial value:
= [
'blockedtext' => [ 'apierror-blocked', 'blocked' ],
'blockedtext-partial' => [ 'apierror-blocked', 'blocked' ],
'autoblockedtext' => [ 'apierror-autoblocked', 'autoblocked' ],
'systemblockedtext' => [ 'apierror-systemblocked', 'blocked' ],
]

$var array Map of web UI block messages to corresponding API messages and codes

Definition at line 274 of file ApiBase.php.

◆ $extensionInfo

array ApiBase::$extensionInfo = null
staticprivate

Maps extension paths to info arrays.

Definition at line 268 of file ApiBase.php.

◆ $filterIDsCache

int [][][] ApiBase::$filterIDsCache = []
staticprivate

Cache for self::filterIDs()

Definition at line 271 of file ApiBase.php.

◆ $mMainModule

ApiMain ApiBase::$mMainModule
private

Definition at line 282 of file ApiBase.php.

Referenced by getMain(), and isMain().

◆ $mModuleName

string ApiBase::$mModuleName
private

Definition at line 284 of file ApiBase.php.

Referenced by getModuleName().

◆ $mModulePrefix

string ApiBase::$mModulePrefix

Definition at line 284 of file ApiBase.php.

Referenced by getModulePrefix().

◆ $mModuleSource

array null bool ApiBase::$mModuleSource = false
private

Definition at line 288 of file ApiBase.php.

Referenced by getModuleSourceInfo().

◆ $mParamCache

ApiBase::$mParamCache = []
private

Definition at line 286 of file ApiBase.php.

◆ $mReplicaDB

ApiBase::$mReplicaDB = null
private

Definition at line 285 of file ApiBase.php.

Referenced by getDB().

◆ ALL_DEFAULT_STRING

const ApiBase::ALL_DEFAULT_STRING = '*'

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

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

◆ LIMIT_BIG1

const ApiBase::LIMIT_BIG1 = 500

Fast query, standard limit.

Definition at line 252 of file ApiBase.php.

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

◆ LIMIT_BIG2

const ApiBase::LIMIT_BIG2 = 5000

Fast query, apihighlimits limit.

Definition at line 254 of file ApiBase.php.

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

◆ LIMIT_SML1

◆ LIMIT_SML2

const ApiBase::LIMIT_SML2 = 500

◆ PARAM_ALL

const ApiBase::PARAM_ALL = 17

(boolean|string) When PARAM_TYPE has a defined set of values and PARAM_ISMULTI is true, this allows for an asterisk ('*') to be passed in place of a pipe-separated list of every possible value.

If a string is set, it will be used in place of the asterisk.

Since
1.29

Definition at line 180 of file ApiBase.php.

Referenced by ApiComparePages\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), and ApiBaseTest\provideGetParameterFromSettings().

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

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

◆ PARAM_DEPRECATED

◆ PARAM_DEPRECATED_VALUES

const ApiBase::PARAM_DEPRECATED_VALUES = 20

(array) When PARAM_TYPE is an array, this indicates which of the values are deprecated.

Keys are the deprecated parameter values, values define the warning message to emit: either boolean true (to use a default message) or a $msg for ApiBase::makeMessage().

Since
1.30

Definition at line 202 of file ApiBase.php.

Referenced by ApiQueryUserInfo\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryRevisionsBase\getAllowedParams(), ApiParse\getAllowedParams(), ApiQueryInfo\getAllowedParams(), getFinalParamDescription(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), and ApiBaseTest\provideGetParameterFromSettings().

◆ PARAM_DFLT

const ApiBase::PARAM_DFLT = 0

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

Definition at line 48 of file ApiBase.php.

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

◆ PARAM_EXTRA_NAMESPACES

const ApiBase::PARAM_EXTRA_NAMESPACES = 18

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

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

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

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

◆ 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}. Specify an empty array to use the default message key for all values.

Since
1.25

Definition at line 157 of file ApiBase.php.

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

◆ PARAM_ISMULTI

const ApiBase::PARAM_ISMULTI = 1

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

titles)?

Definition at line 51 of file ApiBase.php.

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

◆ PARAM_ISMULTI_LIMIT1

const ApiBase::PARAM_ISMULTI_LIMIT1 = 21

(integer) Maximum number of values, for normal users.

Must be used with PARAM_ISMULTI.

Since
1.30

Definition at line 208 of file ApiBase.php.

Referenced by ApiBlock\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), and ApiBaseTest\provideGetParameterFromSettings().

◆ PARAM_ISMULTI_LIMIT2

const ApiBase::PARAM_ISMULTI_LIMIT2 = 22

(integer) Maximum number of values, for users with the apihighimits right.

Must be used with PARAM_ISMULTI.

Since
1.30

Definition at line 215 of file ApiBase.php.

Referenced by ApiBlock\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), 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 90 of file ApiBase.php.

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

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

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

◆ PARAM_MAX_BYTES

const ApiBase::PARAM_MAX_BYTES = 23

(integer) Maximum length of a string in bytes (in UTF-8 encoding).

Since
1.31

Definition at line 221 of file ApiBase.php.

Referenced by ApiParamInfo\getModuleInfo(), and ApiBaseTest\provideGetParameterFromSettings().

◆ PARAM_MAX_CHARS

const ApiBase::PARAM_MAX_CHARS = 24

(integer) Maximum length of a string in characters (unicode codepoints).

Since
1.31

Definition at line 227 of file ApiBase.php.

Referenced by ApiParamInfo\getModuleInfo(), and ApiBaseTest\provideGetParameterFromSettings().

◆ PARAM_MIN

const ApiBase::PARAM_MIN = 5

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

Definition at line 99 of file ApiBase.php.

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

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

Referenced by ApiEditPage\getAllowedParams(), ApiParamInfo\getModuleInfo(), getParameterFromSettings(), and ApiBaseTest\provideGetParameterFromSettings().

◆ PARAM_REQUIRED

◆ PARAM_SENSITIVE

const ApiBase::PARAM_SENSITIVE = 19

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

Since
1.29

Definition at line 193 of file ApiBase.php.

Referenced by ApiBaseTest\doGetParameterFromSettings(), ApiCheckToken\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiLogin\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), and ApiBaseTest\provideGetParameterFromSettings().

◆ 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(), getFinalParamDescription(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), and ApiBaseTest\provideGetParameterFromSettings().

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

const ApiBase::PARAM_TEMPLATE_VARS = 25

(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 245 of file ApiBase.php.

Referenced by extractRequestParams(), ApiComparePages\getAllowedParams(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), and ApiBaseTest\testExtractRequestParams().

◆ 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. Forces PARAM_ALL = true to support easily specifying all namespaces.
  • 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 87 of file ApiBase.php.

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

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

Referenced by ApiHelp\getHelpInternal().


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