MediaWiki  REL1_24
ApiBase Class Reference

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

Inheritance diagram for ApiBase:
Collaboration diagram for ApiBase:

List of all members.

Public Member Functions

 __construct (ApiMain $mainModule, $moduleName, $modulePrefix= '')

Public Attributes

string $mModulePrefix
const GET_VALUES_FOR_HELP = 1
 getAllowedParams() flag: When set, the result could take longer to generate, but should be more thorough.
const LIMIT_BIG1 = 500
const LIMIT_BIG2 = 5000
const LIMIT_SML1 = 50
const LIMIT_SML2 = 500
const PARAM_ALLOW_DUPLICATES = 6
const PARAM_DEPRECATED = 7
const PARAM_DFLT = 0
const PARAM_ISMULTI = 1
const PARAM_MAX = 3
const PARAM_MAX2 = 4
const PARAM_MIN = 5
const PARAM_RANGE_ENFORCE = 9
const PARAM_REQUIRED = 8
const PARAM_TYPE = 2

Private Attributes

ApiMain $mMainModule
 *
string $mModuleName
 *
 $mParamCache = array()
 $mSlaveDB = null

Methods to implement

 execute ()
 Evaluates the parameters, performs the requested query, and sets up the result.
 getModuleManager ()
 Get the module manager, or null if this module has no sub-modules.
 getCustomPrinter ()
 If the module may only be used with a certain format module, it should override this method to return an instance of that formatter.
 getHelpUrls ()
 shouldCheckMaxlag ()
 Indicates if this module needs maxlag to be checked.
 isReadMode ()
 Indicates whether this module requires read rights.
 isWriteMode ()
 Indicates whether this module requires write mode.
 mustBePosted ()
 Indicates whether this module must be called with a POST request.
 needsToken ()
 Returns the token type this module requires in order to execute.
 getDescription ()
 Returns the description string for this module.
 getExamples ()
 Returns usage examples for this module.
 getAllowedParams ()
 Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (array with PARAM_* constants as keys) Don't call this function directly: use getFinalParams() to allow hooks to modify parameters as needed.
 getParamDescription ()
 Returns an array of parameter descriptions.
 getWebUITokenSalt (array $params)
 Fetch the salt used in the Web UI corresponding to this module.

Data access methods

 getModuleName ()
 Get the name of the module being executed by this instance.
 getModulePrefix ()
 Get parameter prefix (usually two letters or an empty string).
 getMain ()
 Get the main module.
 isMain ()
 Returns true if this module is the main module ($this === $this->mMainModule), false otherwise.
 getResult ()
 Get the result object.
 getResultData ()
 Get the result data array (read-only)
 getFinalDescription ()
 Get final module description, after hooks have had a chance to tweak it as needed.
 getFinalParams ($flags=0)
 Get final list of parameters, after hooks have had a chance to tweak it as needed.
 getFinalParamDescription ()
 Get final parameter descriptions, after hooks have had a chance to tweak it as needed.
 getDB ()
 Gets a default slave database connection object.

Parameter handling

 encodeParamName ($paramName)
 This method mangles parameter name based on the prefix supplied to the constructor.
 extractRequestParams ($parseLimit=true)
 Using getAllowedParams(), this function makes an array of the values provided by the user, with key being the name of the variable, and value - validated value from user or default.
 requireOnlyOneParameter ($params, $required)
 Die if none or more than one of a certain set of parameters is set and not false.
 requireMaxOneParameter ($params, $required)
 Die if more than one of a certain set of parameters is set and not false.
 requireAtLeastOneParameter ($params, $required)
 Die if none of a certain set of parameters is set and not false.
 getTitleOrPageId ($params, $load=false)
 Get a WikiPage object from a title or pageid param, if possible.
 validateToken ($token, array $params)
 Validate the supplied token.
 getParameter ($paramName, $parseLimit=true)
 Get a value for the given parameter.
 getWatchlistValue ($watchlist, $titleObj, $userOption=null)
 Return true if we're to watch the page, false if not, null if no change.
 getParameterFromSettings ($paramName, $paramSettings, $parseLimit)
 Using the settings determine the value for the given parameter.
 parseMultiValue ($valueName, $value, $allowMultiple, $allowedValues)
 Return an array of values that were given in a 'a|b|c' notation, after it optionally validates them against the list allowed values.
 validateLimit ($paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
 Validate the value against the minimum and user/bot maximum limits.
 validateTimestamp ($value, $encParamName)
 Validate and normalize of parameters of type 'timestamp'.
 parameterNotEmpty ($x)
 Callback function used in requireOnlyOneParameter to check whether required parameters are set.
 validateUser ($value, $encParamName)
 Validate and normalize of parameters of type 'user'.

Utility methods

 getWatchlistUser ($params)
 Gets the user for whom to get the watchlist.
 setWatch ($watch, $titleObj, $userOption=null)
 Set a watch (or unwatch) based the based on a watchlist parameter.
static truncateArray (&$arr, $limit)
 Truncate an array to a certain length.

Warning and error reporting

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

Help message generation

 makeHelpMsg ()
 Generates help message for this module, or false if there is no description.
 makeHelpMsgParameters ()
 Generates the parameter descriptions for this module, to be displayed in the module's help.
 makeHelpArrayToString ($prefix, $title, $input)
 indentExampleText ($item)

Profiling

 $mModuleTime = 0
 Profiling: total module execution time.
 $mDBTime = 0
 Profiling: total module execution time.
 $mTimeIn = 0
 Profiling: total module execution time.
 $mDBTimeIn = 0
 Profiling: database execution time.
 getModuleProfileName ($db=false)
 Get the name of the module as shown in the profiler log.
 profileIn ()
 Start module profiling.
 profileOut ()
 End module profiling.
 safeProfileOut ()
 When modules crash, sometimes it is needed to do a profileOut() regardless of the profiling state the module was in.
 getProfileTime ()
 Total time the module was executed.
 profileDBIn ()
 Start module profiling.
 profileDBOut ()
 End database profiling.
 getProfileDBTime ()
 Total time the module used the database.
 logFeatureUsage ($feature)
 Write logging information for API features to a debug log, for usage analysis.

Deprecated

const PROP_ROOT = 'ROOT'
const PROP_LIST = 'LIST'
const PROP_TYPE = 0
const PROP_NULLABLE = 1
 getVersion ()
 Formerly returned a string that identifies the version of the extending class.
 getFinalResultProperties ()
 getRequireOnlyOneParameterErrorMessages ($params)
 getRequireMaxOneParameterErrorMessages ($params)
 getRequireAtLeastOneParameterErrorMessages ($params)
 getTitleOrPageIdErrorMessage ()
 getPossibleErrors ()
 This formerly attempted to return a list of all possible errors returned by the module.
 getFinalPossibleErrors ()
 parseErrors ($errors)
 getResultProperties ()
 Formerly used to fetch a list of possible properites in the result, somehow organized with respect to the prop parameter that causes them to be returned.
static addTokenProperties (&$props, $tokenFunctions)

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.

Profiling: various methods to allow keeping tabs on various tasks and their time costs

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

Definition at line 42 of file ApiBase.php.


Constructor & Destructor Documentation

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

Definition at line 90 of file ApiBase.php.


Member Function Documentation

static ApiBase::addTokenProperties ( &$  props,
tokenFunctions 
) [static, protected]
See also:
self::getResultProperties()
Deprecated:
since 1.24

Definition at line 2287 of file ApiBase.php.

Helper function for readonly errors.

Definition at line 1723 of file ApiBase.php.

Referenced by ApiEditPage\execute().

ApiBase::dieStatus ( status)

Throw a UsageException based on the errors in the Status object.

Since:
1.22
Parameters:
Status$status
Exceptions:
MWException

Definition at line 1215 of file ApiBase.php.

Referenced by ApiCreateAccount\execute(), ApiProtect\execute(), ApiImport\execute(), ApiDelete\execute(), ApiUserrights\getUrUser(), and ApiWatch\watchTitle().

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

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

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

Definition at line 1159 of file ApiBase.php.

Referenced by ApiQuerySiteinfo\appendDbReplLagInfo(), ApiQueryImageInfo\checkParameterNormalise(), ApiComparePages\execute(), ApiCreateAccount\execute(), ApiQueryStashImageInfo\execute(), ApiRevisionDelete\execute(), ApiEditPage\execute(), ApiUpload\execute(), ApiWatch\execute(), ApiHelp\execute(), ApiSetNotificationTimestamp\execute(), ApiPatrol\execute(), ApiOptions\execute(), ApiQueryDeletedrevs\execute(), ApiQueryAllMessages\execute(), ApiDisabled\execute(), ApiQueryFilearchive\execute(), ApiFeedContributions\execute(), ApiQueryBlocks\execute(), ApiFeedRecentChanges\execute(), ApiQueryLogEvents\execute(), ApiQueryContributions\execute(), ApiQueryAllUsers\execute(), ApiFeedWatchlist\execute(), ApiQueryRevisions\execute(), ApiQueryAllPages\executeGenerator(), ApiQueryAllImages\executeGenerator(), ApiQueryRevisions\extractRowInfo(), ApiQueryImageInfo\mergeThumbParams(), ApiQueryContributions\prepareQuery(), ApiQueryBase\prepareUrlQuerySearchString(), ApiQueryContributions\prepareUsername(), ApiQueryBlocks\prepareUsername(), ApiComparePages\revisionOrTitleOrId(), ApiQueryCategoryMembers\run(), ApiQueryWatchlist\run(), ApiQuerySearch\run(), ApiQueryAllPages\run(), ApiQueryAllImages\run(), ApiQueryAllLinks\run(), and ApiQueryRecentChanges\run().

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

Otherwise behaves exactly as dieUsageMsg().

Parameters:
array | string$errorElement of a getUserPermissionsErrors()-style array
Since:
1.21

Definition at line 1749 of file ApiBase.php.

ApiBase::encodeParamName ( paramName)

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

Override this method to change parameter name during runtime

Parameters:
string$paramNameParameter name
Returns:
string Prefixed parameter name

Reimplemented in ApiQueryGeneratorBase.

Definition at line 417 of file ApiBase.php.

Referenced by ApiQueryLogEvents\execute(), ApiResult\setContinueParam(), and ApiResult\setGeneratorContinueParam().

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 ApiResult, ApiMain, ApiQueryInfo, ApiQuery, ApiQueryRecentChanges, ApiPageSet, ApiQueryAllLinks, ApiQueryBacklinks, ApiQueryUsers, ApiQueryRevisions, ApiQueryBacklinksprop, ApiFormatFeedWrapper, ApiQueryORM, ApiQueryLinks, ApiFormatJson, ApiFormatRaw, ApiQueryAllImages, ApiFeedWatchlist, ApiImageRotate, ApiFormatXml, ApiLogin, ApiOpenSearch, ApiQueryAllUsers, ApiQueryContributors, ApiQueryQueryPage, ApiQueryImageInfo, ApiQuerySearch, ApiQueryTags, ApiQueryFileRepoInfo, ApiQueryLogEvents, ApiQueryPagePropNames, ApiQueryContributions, ApiFeedRecentChanges, ApiQueryBlocks, ApiQueryUserInfo, ApiBlock, ApiDelete, ApiFeedContributions, ApiFormatDbg, ApiFormatDump, ApiFormatTxt, ApiParamInfo, ApiQueryFilearchive, ApiQueryPageProps, ApiQueryRandom, ApiRollback, ApiDisabled, ApiQueryAllCategories, ApiQueryCategoryInfo, ApiQueryDisabled, ApiQueryImages, ApiQueryIWLinks, ApiQueryPagesWithProp, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiFormatWddx, ApiFormatYaml, ApiPurge, ApiQueryAllMessages, ApiQueryAllPages, ApiQueryCategories, ApiQueryCategoryMembers, ApiQueryDeletedrevs, ApiQueryDuplicateFiles, ApiQueryExternalLinks, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiQueryLangLinks, ApiQueryProtectedTitles, ApiQuerySiteinfo, ApiUnblock, ApiFileRevert, ApiFormatNone, ApiFormatPhp, ApiOptions, ApiExpandTemplates, ApiHelp, ApiParse, ApiPatrol, ApiQueryExtLinksUsage, ApiQueryTokens, ApiSetNotificationTimestamp, ApiEditPage, ApiLogout, ApiUpload, ApiUserrights, ApiWatch, ApiImport, ApiQueryStashImageInfo, ApiRevisionDelete, ApiRsd, ApiEmailUser, ApiMove, ApiTokens, ApiUndelete, ApiClearHasMsg, ApiCreateAccount, ApiProtect, ApiQueryPrefixSearch, ApiComparePages, MockApi, and MockApiQueryBase.

ApiBase::extractRequestParams ( parseLimit = true)

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

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

Parameters:
bool$parseLimitTrue by default
Returns:
array

Definition at line 430 of file ApiBase.php.

Referenced by ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiComparePages\execute(), ApiCreateAccount\execute(), ApiProtect\execute(), ApiUndelete\execute(), ApiMove\execute(), ApiTokens\execute(), ApiEmailUser\execute(), ApiImport\execute(), ApiQueryStashImageInfo\execute(), ApiRevisionDelete\execute(), ApiEditPage\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiWatch\execute(), ApiPatrol\execute(), ApiQueryTokens\execute(), ApiSetNotificationTimestamp\execute(), ApiExpandTemplates\execute(), ApiHelp\execute(), ApiOptions\execute(), ApiQuerySiteinfo\execute(), ApiQueryDeletedrevs\execute(), ApiUnblock\execute(), ApiQueryExternalLinks\execute(), ApiPurge\execute(), ApiQueryLangLinks\execute(), ApiQueryAllMessages\execute(), ApiQueryCategoryInfo\execute(), ApiQueryIWLinks\execute(), ApiRollback\execute(), ApiQueryFilearchive\execute(), ApiQueryPageProps\execute(), ApiFeedContributions\execute(), ApiDelete\execute(), ApiParamInfo\execute(), ApiBlock\execute(), ApiQueryBlocks\execute(), ApiQueryUserInfo\execute(), ApiFeedRecentChanges\execute(), ApiQueryContributions\execute(), ApiQueryFileRepoInfo\execute(), ApiQueryLogEvents\execute(), ApiQueryPagePropNames\execute(), ApiQueryTags\execute(), ApiQueryImageInfo\execute(), ApiQueryContributors\execute(), ApiOpenSearch\execute(), ApiQueryAllUsers\execute(), ApiLogin\execute(), ApiFormatXml\execute(), ApiImageRotate\execute(), ApiFeedWatchlist\execute(), ApiFormatJson\execute(), ApiQueryRevisions\execute(), ApiQueryUsers\execute(), ApiQueryInfo\execute(), ApiOpenSearch\getCustomPrinter(), ApiFormatJson\getMimeType(), ApiQueryORM\getParams(), ApiQueryPrefixSearch\run(), ApiQueryImages\run(), ApiQueryLangBacklinks\run(), ApiQueryIWBacklinks\run(), ApiQueryProtectedTitles\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryCategories\run(), ApiQueryDuplicateFiles\run(), ApiQueryAllCategories\run(), ApiQueryCategoryMembers\run(), ApiQueryPagesWithProp\run(), ApiQueryWatchlist\run(), ApiQuerySearch\run(), ApiQueryQueryPage\run(), ApiQueryAllPages\run(), ApiQueryLinks\run(), ApiQueryAllImages\run(), ApiQueryBacklinksprop\run(), ApiQueryRandom\run(), ApiQueryAllLinks\run(), and ApiQueryRecentChanges\run().

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|bool

Reimplemented in ApiMain, ApiQueryInfo, ApiQuerySiteinfo, ApiQueryRevisions, ApiUpload, ApiParse, ApiQueryImageInfo, ApiQueryRecentChanges, ApiEditPage, ApiQueryContributions, ApiQueryBacklinks, ApiQueryWatchlist, ApiQueryDeletedrevs, ApiQueryAllUsers, ApiQueryBacklinksprop, ApiQueryUsers, ApiQueryAllImages, ApiQueryCategoryMembers, ApiQueryBlocks, ApiParamInfo, ApiQueryAllLinks, ApiQuerySearch, ApiQueryFilearchive, ApiFormatXml, ApiQueryORM, ApiQueryUserInfo, ApiQueryAllPages, ApiQueryContributors, ApiQueryAllMessages, ApiMove, ApiQueryLinks, ApiDelete, ApiCreateAccount, ApiQueryCategories, ApiLogin, ApiQueryProtectedTitles, ApiRevisionDelete, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiFeedContributions, ApiQueryDuplicateFiles, ApiQueryAllCategories, ApiQueryRandom, ApiBlock, ApiQueryIWLinks, ApiQueryExtLinksUsage, ApiProtect, ApiQueryQueryPage, ApiQueryImages, ApiQueryLangLinks, ApiExpandTemplates, ApiQueryTags, ApiHelp, ApiOptions, ApiQueryWatchlistRaw, ApiQueryPagesWithProp, ApiQueryPageProps, ApiFileRevert, ApiFeedRecentChanges, ApiComparePages, ApiQueryExternalLinks, ApiQueryCategoryInfo, ApiImport, ApiRollback, ApiUndelete, ApiEmailUser, ApiUserrights, ApiUnblock, ApiQueryPagePropNames, ApiQueryPrefixSearch, ApiQueryStashImageInfo, ApiTokens, ApiPatrol, ApiFormatJson, ApiQueryTokens, ApiOpenSearch, ApiQueryFileRepoInfo, ApiRsd, ApiLogout, ApiDisabled, ApiQueryDisabled, and MockApi.

Definition at line 179 of file ApiBase.php.

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.

Returns:
mixed Instance of a derived class of ApiFormatBase, or null

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

Definition at line 139 of file ApiBase.php.

ApiBase::getDB ( ) [protected]

Gets a default slave database connection object.

Returns:
DatabaseBase

Reimplemented in ApiPageSet, ApiQueryBase, and ApiQueryAllImages.

Definition at line 330 of file ApiBase.php.

Referenced by ApiProtect\execute(), and ApiBlock\execute().

ApiBase::getDescription ( ) [protected]

Returns the description string for this module.

Returns:
string|array

Reimplemented in ApiMain, ApiQuerySiteinfo, ApiQueryInfo, ApiQueryRevisions, ApiParse, ApiQueryImageInfo, ApiUpload, ApiQueryRecentChanges, ApiQuery, ApiQueryLogEvents, ApiQueryWatchlist, ApiQueryContributions, ApiQueryBacklinks, ApiQueryDeletedrevs, ApiEditPage, ApiQueryBacklinksprop, ApiQueryAllUsers, ApiQueryCategoryMembers, ApiQueryAllImages, ApiQueryBlocks, ApiQuerySearch, ApiQueryUsers, ApiFormatBase, ApiQueryAllLinks, ApiQueryAllPages, ApiQueryFilearchive, ApiParamInfo, ApiQueryUserInfo, ApiQueryContributors, ApiQueryAllMessages, ApiFeedWatchlist, ApiFormatXml, ApiQueryProtectedTitles, ApiMove, ApiQueryExtLinksUsage, ApiSetNotificationTimestamp, ApiQueryCategories, ApiDelete, ApiQueryLinks, ApiRevisionDelete, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiQueryAllCategories, ApiFeedContributions, ApiImageRotate, ApiProtect, ApiWatch, ApiFeedRecentChanges, ApiLogin, ApiQueryIWLinks, ApiQueryLangLinks, ApiQueryWatchlistRaw, ApiQueryDuplicateFiles, ApiBlock, ApiExpandTemplates, ApiQueryPagesWithProp, ApiQueryRandom, ApiQueryImages, ApiQueryTags, ApiOptions, ApiCreateAccount, ApiQueryQueryPage, ApiHelp, ApiPurge, ApiQueryExternalLinks, ApiFileRevert, ApiQueryPageProps, ApiRollback, ApiComparePages, ApiUndelete, ApiImport, ApiQueryStashImageInfo, ApiUserrights, ApiQueryCategoryInfo, ApiEmailUser, ApiFormatWddx, ApiQueryPrefixSearch, ApiUnblock, ApiQueryFileRepoInfo, ApiOpenSearch, ApiQueryPagePropNames, ApiPatrol, ApiTokens, ApiFormatJson, ApiQueryTokens, ApiRsd, ApiLogout, ApiDisabled, ApiQueryDisabled, ApiFormatDump, ApiFormatDbg, ApiFormatTxt, ApiClearHasMsg, ApiFormatYaml, ApiFormatPhp, and ApiFormatNone.

Definition at line 147 of file ApiBase.php.

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

Since:
1.23
Parameters:
Status$status
Returns:
array Array of code and error string

Definition at line 1176 of file ApiBase.php.

Referenced by ApiWatch\watchTitle().

ApiBase::getExamples ( ) [protected]

Returns usage examples for this module.

Return false if no examples are available.

Returns:
bool|string|array

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

Definition at line 155 of file ApiBase.php.

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

Returns:
array|bool False on no parameters

Definition at line 346 of file ApiBase.php.

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

Returns:
array|bool False on no parameter descriptions

Definition at line 382 of file ApiBase.php.

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

See also:
self::getPossibleErrors()
Deprecated:
since 1.24
Returns:
array

Definition at line 2351 of file ApiBase.php.

See also:
self::getResultProperties()
Deprecated:
since 1.24
Returns:
array|bool

Definition at line 2278 of file ApiBase.php.

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

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

Returns:
string

Definition at line 275 of file ApiBase.php.

Referenced by ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiQueryTags\doTag(), ApiComparePages\execute(), ApiProtect\execute(), ApiClearHasMsg\execute(), ApiUndelete\execute(), ApiTokens\execute(), ApiEmailUser\execute(), ApiMove\execute(), ApiRevisionDelete\execute(), ApiImport\execute(), ApiQueryStashImageInfo\execute(), ApiEditPage\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiWatch\execute(), ApiPatrol\execute(), ApiSetNotificationTimestamp\execute(), ApiHelp\execute(), ApiExpandTemplates\execute(), ApiQueryTokens\execute(), ApiOptions\execute(), ApiQueryDeletedrevs\execute(), ApiPurge\execute(), ApiQueryAllMessages\execute(), ApiUnblock\execute(), ApiRollback\execute(), ApiQueryFilearchive\execute(), ApiDelete\execute(), ApiBlock\execute(), ApiParamInfo\execute(), ApiQueryBlocks\execute(), ApiQueryUserInfo\execute(), ApiQueryContributions\execute(), ApiQueryLogEvents\execute(), ApiQueryPagePropNames\execute(), ApiQueryTags\execute(), ApiQueryAllUsers\execute(), ApiImageRotate\execute(), ApiQueryRevisions\execute(), ApiQueryUsers\execute(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryBacklinksprop\getDescription(), ApiQueryLinks\getExamples(), ApiFormatBase\getExamples(), ApiQueryAllLinks\getExamples(), ApiQueryBacklinksprop\getExamples(), ApiQueryAllLinks\getHelpUrls(), ApiQueryBacklinksprop\getHelpUrls(), ApiQueryBacklinksprop\getParamDescription(), ApiFormatBase\markDeprecated(), ApiQueryPrefixSearch\run(), ApiQueryIWBacklinks\run(), ApiQueryProtectedTitles\run(), ApiQueryLangBacklinks\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryCategoryMembers\run(), ApiQueryAllCategories\run(), ApiQueryPagesWithProp\run(), ApiQueryWatchlist\run(), ApiQueryQueryPage\run(), ApiQuerySearch\run(), ApiQueryAllPages\run(), ApiQueryAllImages\run(), ApiQueryBacklinksprop\run(), ApiQueryRandom\run(), ApiQueryAllLinks\run(), ApiQueryRecentChanges\run(), ApiQueryRandom\runQuery(), ApiResult\setContinueParam(), and ApiResult\setGeneratorContinueParam().

Get parameter prefix (usually two letters or an empty string).

Returns:
string

Definition at line 283 of file ApiBase.php.

Referenced by ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiQueryStashImageInfo\execute(), ApiWatch\execute(), ApiQueryDeletedrevs\execute(), ApiQueryUserInfo\getCurrentUserInfo(), ApiQueryDeletedrevs\getDescription(), ApiQueryAllLinks\getExamples(), ApiQueryBacklinksprop\getHelpUrls(), ApiUnblock\getParamDescription(), ApiQueryStashImageInfo\getParamDescription(), ApiQueryExternalLinks\getParamDescription(), ApiProtect\getParamDescription(), ApiCreateAccount\getParamDescription(), ApiQueryExtLinksUsage\getParamDescription(), ApiDelete\getParamDescription(), ApiMove\getParamDescription(), ApiQueryProtectedTitles\getParamDescription(), ApiQueryAllPages\getParamDescription(), ApiQueryAllLinks\getParamDescription(), ApiQueryBlocks\getParamDescription(), ApiQueryCategoryMembers\getParamDescription(), ApiQueryAllImages\getParamDescription(), ApiQueryBacklinksprop\getParamDescription(), ApiQueryDeletedrevs\getParamDescription(), ApiQueryWatchlist\getParamDescription(), ApiQueryContributions\getParamDescription(), ApiQueryLogEvents\getParamDescription(), ApiEditPage\getParamDescription(), ApiQueryRecentChanges\getParamDescription(), ApiQueryImageInfo\getParamDescription(), ApiQueryRevisions\getParamDescription(), ApiQuerySiteinfo\getParamDescription(), ApiQueryImageInfo\getScale(), ApiQueryImageInfo\mergeThumbParams(), ApiQueryPrefixSearch\run(), ApiQueryProtectedTitles\run(), ApiQueryExtLinksUsage\run(), ApiQueryAllImages\run(), and ApiQueryAllLinks\run().

Get the name of the module as shown in the profiler log.

Parameters:
DatabaseBase | bool$db
Returns:
string

Definition at line 2097 of file ApiBase.php.

Returns an array of parameter descriptions.

Don't call this function directly: use getFinalParamDescription() to allow hooks to modify descriptions as needed.

Returns:
array|bool False on no parameter descriptions

Reimplemented in ApiPageSet, ApiMain, ApiQuerySiteinfo, ApiQueryInfo, ApiQueryRevisions, ApiQueryImageInfo, ApiUpload, ApiParse, ApiQueryRecentChanges, ApiQuery, ApiEditPage, ApiQueryLogEvents, ApiQueryContributions, ApiQueryWatchlist, ApiQueryBacklinks, ApiQueryDeletedrevs, ApiQueryAllUsers, ApiQueryBacklinksprop, ApiQueryAllImages, ApiQueryCategoryMembers, ApiQueryBlocks, ApiQuerySearch, ApiQueryUsers, ApiQueryAllLinks, ApiQueryAllPages, ApiParamInfo, ApiQueryFilearchive, ApiQueryORM, ApiQueryUserInfo, ApiFormatXml, ApiQueryContributors, ApiFeedWatchlist, ApiQueryAllMessages, ApiSetNotificationTimestamp, ApiQueryProtectedTitles, ApiMove, ApiQueryCategories, ApiQueryLinks, ApiDelete, ApiQueryExtLinksUsage, ApiCreateAccount, ApiRevisionDelete, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiImageRotate, ApiFeedContributions, ApiQueryAllCategories, ApiWatch, ApiLogin, ApiQueryDuplicateFiles, ApiQueryIWLinks, ApiProtect, ApiQueryLangLinks, ApiQueryWatchlistRaw, ApiFeedRecentChanges, ApiBlock, ApiQueryRandom, ApiQueryImages, ApiExpandTemplates, ApiQueryPagesWithProp, ApiQueryQueryPage, ApiQueryTags, ApiOptions, ApiHelp, ApiPurge, ApiFileRevert, ApiQueryPageProps, ApiComparePages, ApiQueryExternalLinks, ApiRollback, ApiUndelete, ApiImport, ApiQueryStashImageInfo, ApiQueryCategoryInfo, ApiUserrights, ApiEmailUser, ApiQueryPrefixSearch, ApiQueryPagePropNames, ApiUnblock, ApiOpenSearch, ApiQueryFileRepoInfo, ApiPatrol, ApiTokens, ApiFormatJson, ApiQueryTokens, ApiRsd, ApiLogout, ApiDisabled, and ApiQueryDisabled.

Definition at line 191 of file ApiBase.php.

ApiBase::getParameter ( paramName,
parseLimit = true 
) [protected]

Get a value for the given parameter.

Parameters:
string$paramNameParameter name
bool$parseLimitSee extractRequestParams()
Returns:
mixed Parameter value

Definition at line 454 of file ApiBase.php.

Referenced by ApiQuerySiteinfo\appendSkins(), ApiFeedRecentChanges\execute(), and ApiMain\sendCacheHeaders().

ApiBase::getParameterFromSettings ( paramName,
paramSettings,
parseLimit 
) [protected]

Using the settings determine the value for the given parameter.

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

Definition at line 632 of file ApiBase.php.

This formerly attempted to return a list of all possible errors returned by the module.

However, this was impossible to maintain in many cases since errors could come from other areas of MediaWiki and in some cases from arbitrary extension hooks. Since a partial list claiming to be comprehensive is unlikely to be useful, it was removed.

Deprecated:
since 1.24
Returns:
array

Definition at line 2341 of file ApiBase.php.

Total time the module used the database.

Returns:
float

Definition at line 2206 of file ApiBase.php.

Total time the module was executed.

Returns:
float

Definition at line 2152 of file ApiBase.php.

See also:
self::getPossibleErrors()
Deprecated:
since 1.24
Returns:
array

Definition at line 2316 of file ApiBase.php.

See also:
self::getPossibleErrors()
Deprecated:
since 1.24
Returns:
array

Definition at line 2306 of file ApiBase.php.

See also:
self::getPossibleErrors()
Deprecated:
since 1.24
Returns:
array

Definition at line 2296 of file ApiBase.php.

Get the result object.

Returns:
ApiResult

Reimplemented in ApiMain.

Definition at line 308 of file ApiBase.php.

Referenced by ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiQueryORM\addSerializedResults(), ApiQuerySiteinfo\appendDbReplLagInfo(), ApiQuerySiteinfo\appendDefaultOptions(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendExtensionTags(), ApiQuerySiteinfo\appendFileExtensions(), ApiQuerySiteinfo\appendFunctionHooks(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiQuerySiteinfo\appendMagicWords(), ApiQuerySiteinfo\appendNamespaceAliases(), ApiQuerySiteinfo\appendNamespaces(), ApiQuerySiteinfo\appendProtocols(), ApiQuerySiteinfo\appendRestrictions(), ApiQuerySiteinfo\appendRightsInfo(), ApiQuerySiteinfo\appendSkins(), ApiQuerySiteinfo\appendSpecialPageAliases(), ApiQuerySiteinfo\appendStatistics(), ApiQuerySiteinfo\appendSubscribedHooks(), ApiQuerySiteinfo\appendUserGroups(), ApiQuerySiteinfo\appendVariables(), ApiComparePages\execute(), ApiCreateAccount\execute(), ApiProtect\execute(), ApiClearHasMsg\execute(), ApiUndelete\execute(), ApiMove\execute(), ApiTokens\execute(), ApiEmailUser\execute(), ApiQueryStashImageInfo\execute(), ApiRevisionDelete\execute(), ApiRsd\execute(), ApiImport\execute(), ApiEditPage\execute(), ApiUpload\execute(), ApiUserrights\execute(), ApiWatch\execute(), ApiExpandTemplates\execute(), ApiPatrol\execute(), ApiQueryTokens\execute(), ApiHelp\execute(), ApiSetNotificationTimestamp\execute(), ApiOptions\execute(), ApiQueryDeletedrevs\execute(), ApiUnblock\execute(), ApiPurge\execute(), ApiQueryAllMessages\execute(), ApiQueryPageProps\execute(), ApiQueryFilearchive\execute(), ApiRollback\execute(), ApiBlock\execute(), ApiFeedContributions\execute(), ApiParamInfo\execute(), ApiDelete\execute(), ApiQueryBlocks\execute(), ApiFeedRecentChanges\execute(), ApiQueryUserInfo\execute(), ApiQueryPagePropNames\execute(), ApiQueryFileRepoInfo\execute(), ApiQueryContributions\execute(), ApiQueryLogEvents\execute(), ApiQueryTags\execute(), ApiQueryImageInfo\execute(), ApiOpenSearch\execute(), ApiQueryContributors\execute(), ApiQueryAllUsers\execute(), ApiLogin\execute(), ApiImageRotate\execute(), ApiFeedWatchlist\execute(), ApiQueryRevisions\execute(), ApiQueryUsers\execute(), ApiQueryInfo\execute(), ApiQueryInfo\extractPageInfo(), ApiQueryWatchlist\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryRevisions\extractRowInfo(), ApiRevisionDelete\extractStatusInfo(), ApiRsd\formatRsdApiList(), ApiRevisionDelete\formatStatusMessages(), ApiQueryUserInfo\getCurrentUserInfo(), ApiQueryPrefixSearch\run(), ApiQueryProtectedTitles\run(), ApiQueryLangBacklinks\run(), ApiQueryIWBacklinks\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryAllCategories\run(), ApiQueryCategoryMembers\run(), ApiQueryPagesWithProp\run(), ApiQueryWatchlist\run(), ApiQuerySearch\run(), ApiQueryQueryPage\run(), ApiQueryAllPages\run(), ApiQueryAllImages\run(), ApiQueryRandom\run(), ApiQueryAllLinks\run(), ApiQueryRecentChanges\run(), ApiQueryRandom\runQuery(), ApiQueryBase\setContinueEnumParameter(), ApiQueryGeneratorBase\setContinueEnumParameter(), ApiQueryORM\setIndexedTagNames(), and ApiUpload\transformWarnings().

Formerly used to fetch a list of possible properites in the result, somehow organized with respect to the prop parameter that causes them to be returned.

The specific semantics of the return value was never specified. Since this was never possible to be accurately updated, it has been removed.

Deprecated:
since 1.24
Returns:
array|bool

Definition at line 2268 of file ApiBase.php.

ApiBase::getTitleOrPageId ( params,
load = false 
)

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

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

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

Definition at line 553 of file ApiBase.php.

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

See also:
self::getPossibleErrors()
Deprecated:
since 1.24
Returns:
array

Definition at line 2326 of file ApiBase.php.

Formerly returned a string that identifies the version of the extending class.

Typically included the class name, the svn revision, timestamp, and last author. Usually done with SVN's Id keyword

Deprecated:
since 1.21, version string is no longer supported
Returns:
string

Reimplemented in MockApi, and MockApiQueryBase.

Definition at line 2253 of file ApiBase.php.

Gets the user for whom to get the watchlist.

Parameters:
array$params
Returns:
User

Definition at line 1068 of file ApiBase.php.

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

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

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

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

Definition at line 590 of file ApiBase.php.

Referenced by ApiEditPage\execute().

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 ApiRollback, and ApiUserrights.

Definition at line 260 of file ApiBase.php.

ApiBase::indentExampleText ( item) [private]
Parameters:
string$item
Returns:
string

Definition at line 1891 of file ApiBase.php.

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

Returns:
bool

Definition at line 300 of file ApiBase.php.

Indicates whether this module requires read rights.

Returns:
bool

Reimplemented in ApiMain, ApiParamInfo, ApiCreateAccount, ApiLogin, ApiHelp, ApiRsd, ApiLogout, and ApiDisabled.

Definition at line 207 of file ApiBase.php.

ApiBase::makeHelpArrayToString ( prefix,
title,
input 
) [protected]
Parameters:
string$prefixText to split output items
string$titleWhat is being output
string | array$input
Returns:
string

Definition at line 1901 of file ApiBase.php.

Generates help message for this module, or false if there is no description.

Returns:
string|bool

Reimplemented in ApiMain, and ApiQuery.

Definition at line 1823 of file ApiBase.php.

Generates the parameter descriptions for this module, to be displayed in the module's help.

Returns:
string|bool

Definition at line 1928 of file ApiBase.php.

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 cause self::getFinalParams() to return a required string 'token' parameter and self::getFinalParamDescription() to ensure there is standardized documentation for it. 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, ApiMove, ApiDelete, ApiRevisionDelete, ApiImageRotate, ApiProtect, ApiSetNotificationTimestamp, ApiBlock, ApiOptions, ApiWatch, ApiFileRevert, ApiRollback, ApiUndelete, ApiImport, ApiUserrights, ApiEmailUser, ApiUnblock, and ApiPatrol.

Definition at line 247 of file ApiBase.php.

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

ApiBase::parseErrors ( errors)
See also:
self::getPossibleErrors()
Deprecated:
since 1.24
Returns:
array

Definition at line 2361 of file ApiBase.php.

ApiBase::parseMsg ( error)

Return the error message related to a certain array.

Parameters:
array$errorElement of a getUserPermissionsErrors()-style array
Returns:
array('code' => code, 'info' => info)

Definition at line 1780 of file ApiBase.php.

Referenced by ApiImageRotate\checkPermissions(), ApiMove\execute(), ApiPurge\execute(), and ApiMove\moveSubpages().

ApiBase::parseMultiValue ( valueName,
value,
allowMultiple,
allowedValues 
) [protected]

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

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

Definition at line 854 of file ApiBase.php.

Start module profiling.

Definition at line 2168 of file ApiBase.php.

Referenced by ApiQueryBase\checkRowCount(), and ApiQueryBase\select().

End database profiling.

Definition at line 2185 of file ApiBase.php.

Referenced by ApiQueryBase\checkRowCount(), and ApiQueryBase\select().

Start module profiling.

Definition at line 2108 of file ApiBase.php.

End module profiling.

Definition at line 2119 of file ApiBase.php.

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

ApiBase::requireMaxOneParameter ( params,
required 
)

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

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

Definition at line 493 of file ApiBase.php.

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

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

Referenced by ApiMove\execute(), ApiPatrol\execute(), and ApiUserrights\getUrUser().

When modules crash, sometimes it is needed to do a profileOut() regardless of the profiling state the module was in.

This method does such cleanup.

Definition at line 2139 of file ApiBase.php.

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

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

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

Definition at line 1037 of file ApiBase.php.

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

Indicates if this module needs maxlag to be checked.

Returns:
bool

Reimplemented in ApiQuery, and ApiHelp.

Definition at line 199 of file ApiBase.php.

static ApiBase::truncateArray ( &$  arr,
limit 
) [static]

Truncate an array to a certain length.

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

Definition at line 1052 of file ApiBase.php.

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

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

Prints usage info on failure.

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

Definition at line 918 of file ApiBase.php.

Referenced by ApiQueryDeletedrevs\execute(), and ApiQueryRevisions\execute().

ApiBase::validateTimestamp ( value,
encParamName 
) [protected]

Validate and normalize of parameters of type 'timestamp'.

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

Definition at line 956 of file ApiBase.php.

ApiBase::validateToken ( token,
array params 
) [final]

Validate the supplied token.

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

Definition at line 976 of file ApiBase.php.

ApiBase::validateUser ( value,
encParamName 
) [private]

Validate and normalize of parameters of type 'user'.

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

Definition at line 1012 of file ApiBase.php.

ApiBase::warnOrDie ( msg,
enforceLimits = false 
) [private]

Adds a warning to the output, else dies.

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

Definition at line 1139 of file ApiBase.php.


Member Data Documentation

ApiBase::$mDBTime = 0

Profiling: total module execution time.

Definition at line 2163 of file ApiBase.php.

ApiBase::$mDBTimeIn = 0 [private]

Profiling: database execution time.

Definition at line 2163 of file ApiBase.php.

ApiBase::$messageMap [static]

Array that maps message keys to error messages.

$1 and friends are replaced.

Definition at line 1225 of file ApiBase.php.

ApiMain ApiBase::$mMainModule [private]

*

Definition at line 80 of file ApiBase.php.

string ApiBase::$mModuleName [private]

*

Definition at line 81 of file ApiBase.php.

string ApiBase::$mModulePrefix

Definition at line 81 of file ApiBase.php.

ApiBase::$mModuleTime = 0

Profiling: total module execution time.

Definition at line 2088 of file ApiBase.php.

ApiBase::$mParamCache = array() [private]

Definition at line 83 of file ApiBase.php.

ApiBase::$mSlaveDB = null [private]

Definition at line 82 of file ApiBase.php.

ApiBase::$mTimeIn = 0 [private]

Profiling: total module execution time.

Definition at line 2088 of file ApiBase.php.

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

Referenced by ApiQueryLogEvents\getAllowedParams().

Definition at line 46 of file ApiBase.php.

Referenced by ApiQueryFileRepoInfo\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiQueryTokens\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiTokens\getAllowedParams(), ApiQueryPrefixSearch\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiOptions\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiRevisionDelete\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiCreateAccount\getAllowedParams(), ApiDelete\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiMove\getAllowedParams(), ApiQueryAllMessages\getAllowedParams(), ApiFeedWatchlist\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryORM\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiEditPage\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiUpload\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), and ApiQueryInfo\getAllowedParams().

Definition at line 48 of file ApiBase.php.

Referenced by ApiQueryFileRepoInfo\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiQueryTokens\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiTokens\getAllowedParams(), ApiQueryPrefixSearch\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiQueryPageProps\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiOptions\getAllowedParams(), ApiHelp\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiRevisionDelete\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryAllMessages\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryORM\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiQuery\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), and ApiQueryInfo\getAllowedParams().

const ApiBase::PARAM_MAX = 3

Definition at line 52 of file ApiBase.php.

Referenced by ApiOpenSearch\getAllowedParams(), ApiQueryPrefixSearch\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiFeedWatchlist\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryORM\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), and ApiQueryRevisions\getAllowedParams().

Definition at line 54 of file ApiBase.php.

Referenced by ApiOpenSearch\getAllowedParams(), ApiQueryPrefixSearch\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryORM\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), and ApiQueryRevisions\getAllowedParams().

const ApiBase::PARAM_MIN = 5

Definition at line 56 of file ApiBase.php.

Referenced by ApiOpenSearch\getAllowedParams(), ApiQueryPrefixSearch\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiFeedWatchlist\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryORM\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), and ApiQueryRevisions\getAllowedParams().

Since:
1.17

Definition at line 66 of file ApiBase.php.

Definition at line 50 of file ApiBase.php.

Referenced by ApiQueryFileRepoInfo\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiQueryTokens\getAllowedParams(), ApiPatrol\getAllowedParams(), ApiTokens\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiQueryPrefixSearch\getAllowedParams(), ApiQueryPagePropNames\getAllowedParams(), ApiUnblock\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiEmailUser\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiImport\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiComparePages\getAllowedParams(), ApiFeedRecentChanges\getAllowedParams(), ApiQueryPagesWithProp\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiOptions\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiBlock\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiWatch\getAllowedParams(), ApiRevisionDelete\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiImageRotate\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiCreateAccount\getAllowedParams(), ApiDelete\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiMove\getAllowedParams(), ApiQueryAllMessages\getAllowedParams(), ApiFeedWatchlist\getAllowedParams(), ApiSetNotificationTimestamp\getAllowedParams(), ApiQueryContributors\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryORM\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryAllImages\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryBacklinksprop\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiEditPage\getAllowedParams(), ApiQuery\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiUpload\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), and ApiQueryInfo\getAllowedParams().

const ApiBase::PROP_LIST = 'LIST'
Deprecated:
since 1.24

Definition at line 2239 of file ApiBase.php.

Deprecated:
since 1.24

Definition at line 2243 of file ApiBase.php.

const ApiBase::PROP_ROOT = 'ROOT'
Deprecated:
since 1.24

Definition at line 2237 of file ApiBase.php.

const ApiBase::PROP_TYPE = 0
Deprecated:
since 1.24

Definition at line 2241 of file ApiBase.php.


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