MediaWiki  REL1_19
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 ($mainModule, $moduleName, $modulePrefix= '')
 Constructor.
 createContext ()
 Create a new RequestContext object to use e.g.
 dieReadOnly ()
 Helper function for readonly errors.
 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.
 dieUsageMsg ($error)
 Output the error message related to a certain array.
 encodeParamName ($paramName)
 This method mangles parameter name based on the prefix supplied to the constructor.
 execute ()
 Evaluates the parameters, performs the requested query, and sets up the result.
 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.
 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.
 getFinalDescription ()
 Get final module description, 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.
 getFinalParams ()
 Get final list of parameters, after hooks have had a chance to tweak it as needed.
 getHelpUrls ()
 getMain ()
 Get the main module.
 getModuleName ()
 Get the name of the module being executed by this instance.
 getModulePrefix ()
 Get parameter prefix (usually two letters or an empty string).
 getModuleProfileName ($db=false)
 Get the name of the module as shown in the profiler log.
 getPossibleErrors ()
 Returns a list of all possible errors returned by the module.
 getProfileDBTime ()
 Total time the module used the database.
 getProfileTime ()
 Total time the module was executed.
 getRequireMaxOneParameterErrorMessages ($params)
 Generates the possible error requireMaxOneParameter() can die with.
 getRequireOnlyOneParameterErrorMessages ($params)
 Generates the possible errors requireOnlyOneParameter() can die with.
 getResult ()
 Get the result object.
 getResultData ()
 Get the result data array (read-only)
 getTokenSalt ()
 Returns the token salt if there is one, '' if the module doesn't require a salt, else false if the module doesn't need a token.
 getVersion ()
 Returns a string that identifies the version of the extending class.
 getWatchlistUser ($params)
 Gets the user for whom to get the watchlist.
 isMain ()
 Returns true if this module is the main module ($this === $this->mMainModule), false otherwise.
 isReadMode ()
 Indicates whether this module requires read rights.
 isWriteMode ()
 Indicates whether this module requires write mode.
 makeHelpMsg ()
 Generates help message for this module, or false if there is no description.
 makeHelpMsg_callback ($matches)
 Callback for preg_replace_callback() call in makeHelpMsg().
 makeHelpMsgParameters ()
 Generates the parameter descriptions for this module, to be displayed in the module's help.
 mustBePosted ()
 Indicates whether this module must be called with a POST request.
 needsToken ()
 Returns whether this module requires a Token to execute.
 parseErrors ($errors)
 Parses a list of errors into a standardised format.
 parseMsg ($error)
 Return the error message related to a certain array.
 profileDBIn ()
 Start module profiling.
 profileDBOut ()
 End database profiling.
 profileIn ()
 Start module profiling.
 profileOut ()
 End module profiling.
 requireMaxOneParameter ($params)
 Die if more than one of a certain set of parameters is set and not false.
 requireOnlyOneParameter ($params)
 Die if none or more than one of a certain set of parameters is set and not false.
 safeProfileOut ()
 When modules crash, sometimes it is needed to do a profileOut() regardless of the profiling state the module was in.
 setWarning ($warning)
 Set warning section for this module.
 shouldCheckMaxlag ()
 Indicates if this module needs maxlag to be checked.
 validateLimit ($paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
 Validate the value against the minimum and user/bot maximum limits.
 validateTimestamp ($value, $paramName)

Static Public Member Functions

static debugPrint ($value, $name= 'unknown', $backtrace=false)
 Debugging function that prints a value and an optional backtrace.
static getBaseVersion ()
 Returns a string that identifies the version of this class.
static getValidNamespaces ()
static truncateArray (&$arr, $limit)
 Truncate an array to a certain length.

Public Attributes

 $mDBTime = 0
 $mModuleName
 $mModulePrefix
 $mModuleTime = 0
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

Static Public Attributes

static $messageMap
 Array that maps message keys to error messages.

Protected Member Functions

 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.
 getDB ()
 getDescription ()
 Returns the description string for this module.
 getExamples ()
 Returns usage examples for this module.
 getParamDescription ()
 Returns an array of parameter descriptions.
 getParameter ($paramName, $parseLimit=true)
 Get a value for the given parameter.
 getParameterFromSettings ($paramName, $paramSettings, $parseLimit)
 Using the settings determine the 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.
 makeHelpArrayToString ($prefix, $title, $input)
 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.
 setWatch ($watch, $titleObj, $userOption=null)
 Set a watch (or unwatch) based the based on a watchlist parameter.

Static Protected Member Functions

static dieDebug ($method, $message)
 Internal code errors should be reported with this method.

Private Member Functions

 indentExampleText ($item)
 parameterNotEmpty ($x)
 Callback function used in requireOnlyOneParameter to check whether reequired parameters are set.
 warnOrDie ($msg, $enforceLimits=false)
 Adds a warning to the output, else dies.

Private Attributes

 $mDBTimeIn = 0
 Profiling: database execution time.
 $mMainModule
 $mParamCache = array()
 $mTimeIn = 0
 Profiling: total module execution time.

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 ( mainModule,
moduleName,
modulePrefix = '' 
)

Constructor.

Parameters:
$mainModuleApiMain object
$moduleNamestring Name of this module
$modulePrefixstring Prefix to use for parameter names

Reimplemented in ApiQueryGeneratorBase, ApiPageSet, and ApiQueryImageInfo.

Definition at line 71 of file ApiBase.php.

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

Here is the call graph for this function:


Member Function Documentation

Create a new RequestContext object to use e.g.

for calls to other parts the software. The object will have the WebRequest and the User object set to the ones used in this instance.

Deprecated:
since 1.19 use getContext to get the current context
Returns:
DerivativeContext

Definition at line 189 of file ApiBase.php.

References ContextSource\getContext(), and wfDeprecated().

Here is the call graph for this function:

static ApiBase::debugPrint ( value,
name = 'unknown',
backtrace = false 
) [static]

Debugging function that prints a value and an optional backtrace.

Parameters:
$valuemixed Value to print
$namestring Description of the printed value
$backtracebool If true, print a backtrace

Definition at line 1555 of file ApiBase.php.

References print, and wfBacktrace().

Here is the call graph for this function:

Helper function for readonly errors.

Definition at line 1246 of file ApiBase.php.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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:
$descriptionstring One-line human-readable description of the error condition, e.g., "The API requires a valid action parameter"
$errorCodestring Brief, arbitrary, stable string to allow easy automated identification of the error, e.g., 'unknown_action'
$httpRespCodeint HTTP response code
$extradataarray Data to add to the <error> element; array in ApiResult format

Definition at line 1083 of file ApiBase.php.

References encodeParamName(), and Profiler\instance().

Referenced by ApiQuerySiteinfo\appendDbReplLagInfo(), ApiUpload\checkAsyncDownloadEnabled(), ApiMain\checkMaxLag(), ApiMain\createPrinterByName(), dieReadOnly(), ApiUpload\dieRecoverableError(), dieUsageMsg(), ApiComparePages\execute(), ApiQueryStashImageInfo\execute(), ApiParse\execute(), ApiQueryAllUsers\execute(), ApiQueryDeletedrevs\execute(), ApiWatch\execute(), ApiQueryLangLinks\execute(), ApiQueryIWLinks\execute(), ApiQueryFilearchive\execute(), ApiEditPage\execute(), ApiHelp\execute(), ApiUnblock\execute(), ApiQueryBlocks\execute(), ApiUpload\execute(), ApiQueryImageInfo\execute(), ApiQueryLogEvents\execute(), ApiQueryContributions\execute(), ApiDisabled\execute(), ApiBlock\execute(), ApiFeedContributions\execute(), ApiFeedWatchlist\execute(), ApiQueryRevisions\execute(), ApiQueryInfo\execute(), ApiPageSet\execute(), ApiQueryAllpages\executeGenerator(), ApiQueryAllimages\executeGenerator(), ApiQueryRevisions\extractRowInfo(), ApiUpload\getChunkResult(), getParameterFromSettings(), ApiQueryImageInfo\getScale(), ApiParse\getSectionText(), ApiUpload\getStashResult(), getWatchlistUser(), ApiQueryImageInfo\mergeThumbParams(), ApiQuery\newGenerator(), ApiQueryBacklinks\parseContinueParam(), parseMultiValue(), ApiUpload\performUpload(), ApiQueryContributions\prepareQuery(), ApiQueryBase\prepareUrlQuerySearchString(), ApiQueryContributions\prepareUsername(), ApiQueryBlocks\prepareUsername(), ApiQueryBacklinks\processContinue(), requireMaxOneParameter(), requireOnlyOneParameter(), ApiComparePages\revisionOrTitle(), ApiQueryImages\run(), ApiQuerySearch\run(), ApiQueryLangBacklinks\run(), ApiQueryIWBacklinks\run(), ApiQueryWatchlistRaw\run(), ApiQueryCategories\run(), ApiQueryAllLinks\run(), ApiQueryDuplicateFiles\run(), ApiQueryCategoryMembers\run(), ApiQueryWatchlist\run(), ApiQueryAllpages\run(), ApiQueryAllimages\run(), ApiQueryLinks\run(), ApiQueryRecentChanges\run(), ApiUpload\selectUploadModule(), ApiMain\setupExecuteAction(), validateTimestamp(), ApiUpload\verifyUpload(), and warnOrDie().

Here is the call graph for this function:

ApiBase::dieUsageMsg ( error)

Output the error message related to a certain array.

Parameters:
$error(array|string) Element of a getUserPermissionsErrors()-style array

Definition at line 1256 of file ApiBase.php.

References dieUsage(), and parseMsg().

Referenced by ApiMain\checkExecutePermissions(), ApiFileRevert\checkPermissions(), ApiUpload\checkPermissions(), ApiParse\execute(), ApiProtect\execute(), ApiUndelete\execute(), ApiEmailUser\execute(), ApiMove\execute(), ApiQueryAllmessages\execute(), ApiImport\execute(), ApiWatch\execute(), ApiQueryLangLinks\execute(), ApiQueryIWLinks\execute(), ApiPatrol\execute(), ApiEditPage\execute(), ApiExpandTemplates\execute(), ApiPurge\execute(), ApiUnblock\execute(), ApiUpload\execute(), ApiQueryBlocks\execute(), ApiBlock\execute(), ApiRollback\execute(), ApiDelete\execute(), ApiQueryRevisions\execute(), getParameterFromSettings(), ApiRollback\getRbTitle(), ApiRollback\getRbUser(), ApiUserrights\getUrUser(), ApiQueryBase\keyToTitle(), ApiQueryContributions\prepareQuery(), ApiQueryBacklinks\processContinue(), ApiComparePages\revisionOrTitle(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryWatchlistRaw\run(), ApiQueryCategoryMembers\run(), ApiQueryCategories\run(), ApiQueryWatchlist\run(), ApiQueryQueryPage\run(), ApiQueryRecentChanges\run(), ApiUpload\selectUploadModule(), ApiMain\setupExternalResponse(), ApiMain\setupModule(), ApiQueryBase\titleToKey(), and ApiFileRevert\validateParameters().

Here is the call graph for this function:

Here is the caller graph for this function:

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:
$paramNamestring Parameter name
Returns:
string Prefixed parameter name

Reimplemented in ApiQueryGeneratorBase.

Definition at line 584 of file ApiBase.php.

Referenced by dieUsage(), getParameterFromSettings(), makeHelpMsgParameters(), ApiQueryBase\setContinueEnumParameter(), and validateLimit().

Here is the caller graph for this function:

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 ApiFormatFeedWrapper, ApiResult, ApiMain, ApiPageSet, ApiQueryInfo, ApiQuery, MockApi, ApiQueryRecentChanges, ApiQueryBacklinks, ApiQueryRevisions, ApiQueryUsers, ApiQueryLinks, ApiQueryQueryPage, ApiFormatJson, ApiFormatRaw, ApiFeedWatchlist, ApiFormatXml, ApiQueryAllimages, ApiLogin, ApiQueryTags, ApiDelete, ApiRollback, ApiBlock, ApiFeedContributions, ApiFileRevert, ApiFormatDbg, ApiFormatDump, ApiFormatTxt, ApiDisabled, ApiQueryBlocks, ApiQueryDisabled, ApiQueryImageInfo, ApiQueryLogEvents, ApiQueryContributions, ApiUpload, ApiParamInfo, ApiUnblock, ApiFormatPhp, ApiFormatWddx, ApiHelp, ApiPurge, ApiEditPage, ApiExpandTemplates, ApiOpenSearch, ApiPatrol, ApiQueryFilearchive, ApiQueryPageProps, ApiQueryRandom, ApiQueryUserInfo, ApiLogout, ApiQueryAllCategories, ApiQueryIWLinks, ApiQueryWatchlist, ApiQueryWatchlistRaw, ApiUserrights, ApiImport, ApiQueryAllLinks, ApiQueryAllmessages, ApiQueryAllpages, ApiQueryCategories, ApiQueryCategoryInfo, ApiQueryCategoryMembers, ApiQueryDeletedrevs, ApiQueryDuplicateFiles, ApiQueryExternalLinks, ApiQueryImages, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiQueryLangLinks, ApiQueryProtectedTitles, ApiQuerySearch, ApiQuerySiteinfo, ApiRsd, ApiWatch, ApiEmailUser, ApiMove, ApiQueryAllUsers, ApiProtect, ApiQueryExtLinksUsage, ApiUndelete, ApiParse, ApiQueryStashImageInfo, and ApiComparePages.

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:
$parseLimitBoolean: true by default
Returns:
array

Definition at line 597 of file ApiBase.php.

References getFinalParams(), and getParameterFromSettings().

Referenced by ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiComparePages\execute(), ApiQueryStashImageInfo\execute(), ApiParse\execute(), ApiUndelete\execute(), ApiProtect\execute(), ApiMove\execute(), ApiEmailUser\execute(), ApiQueryAllUsers\execute(), ApiQueryCategoryInfo\execute(), ApiQueryDeletedrevs\execute(), ApiQueryExternalLinks\execute(), ApiWatch\execute(), ApiQueryLangLinks\execute(), ApiImport\execute(), ApiQuerySiteinfo\execute(), ApiQueryAllmessages\execute(), ApiUserrights\execute(), ApiQueryIWLinks\execute(), ApiQueryUserInfo\execute(), ApiOpenSearch\execute(), ApiEditPage\execute(), ApiQueryFilearchive\execute(), ApiPatrol\execute(), ApiQueryPageProps\execute(), ApiExpandTemplates\execute(), ApiPurge\execute(), ApiHelp\execute(), ApiUnblock\execute(), ApiParamInfo\execute(), ApiQueryBlocks\execute(), ApiUpload\execute(), ApiQueryImageInfo\execute(), ApiQueryLogEvents\execute(), ApiQueryContributions\execute(), ApiFileRevert\execute(), ApiFeedContributions\execute(), ApiBlock\execute(), ApiRollback\execute(), ApiDelete\execute(), ApiQueryTags\execute(), ApiLogin\execute(), ApiFeedWatchlist\execute(), ApiFormatXml\execute(), ApiFormatJson\execute(), ApiQueryUsers\execute(), ApiQueryRevisions\execute(), ApiQuery\execute(), ApiQueryInfo\execute(), ApiPageSet\execute(), ApiFormatJson\getMimeType(), ApiRollback\getRbTitle(), ApiRollback\getRbUser(), ApiUserrights\getUrUser(), ApiQueryImages\run(), ApiQuerySearch\run(), ApiQueryLangBacklinks\run(), ApiQueryIWBacklinks\run(), ApiQueryProtectedTitles\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryAllCategories\run(), ApiQueryAllLinks\run(), ApiQueryCategoryMembers\run(), ApiQueryCategories\run(), ApiQueryDuplicateFiles\run(), ApiQueryWatchlist\run(), ApiQueryAllpages\run(), ApiQueryQueryPage\run(), ApiQueryAllimages\run(), ApiQueryLinks\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryBacklinks\run(), and ApiMain\setupExecuteAction().

Here is the call graph for this function:

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.

Returns:
array or false

Reimplemented in ApiMain, ApiPageSet, ApiQueryInfo, ApiQuery, ApiQuerySiteinfo, ApiUpload, ApiQueryRevisions, ApiQueryRecentChanges, ApiParse, ApiQueryImageInfo, ApiQueryBacklinks, ApiEditPage, ApiQueryLogEvents, ApiQueryContributions, ApiQueryWatchlist, ApiQueryAllUsers, ApiQueryDeletedrevs, ApiQueryUsers, ApiQueryCategoryMembers, ApiParamInfo, ApiQueryBlocks, ApiFormatXml, ApiQueryFilearchive, ApiQueryAllmessages, ApiQuerySearch, ApiQueryAllpages, ApiDelete, ApiQueryLinks, ApiQueryCategories, ApiQueryUserInfo, ApiQueryAllimages, ApiLogin, ApiFeedWatchlist, ApiMove, ApiQueryAllLinks, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiBlock, ApiQueryProtectedTitles, ApiQueryQueryPage, ApiQueryImages, ApiQueryExtLinksUsage, MockApi, ApiFeedContributions, ApiQueryRandom, ApiProtect, ApiQueryAllCategories, ApiQueryIWLinks, ApiQueryTags, ApiQueryWatchlistRaw, ApiQueryDuplicateFiles, ApiQueryLangLinks, ApiPurge, ApiQueryPageProps, ApiFileRevert, ApiHelp, ApiQueryExternalLinks, ApiUnblock, ApiImport, ApiQueryCategoryInfo, ApiUndelete, ApiEmailUser, ApiUserrights, ApiComparePages, ApiOpenSearch, ApiWatch, ApiExpandTemplates, ApiRollback, ApiQueryStashImageInfo, ApiFormatJson, ApiPatrol, ApiRsd, ApiLogout, ApiDisabled, and ApiQueryDisabled.

Definition at line 528 of file ApiBase.php.

Referenced by getFinalParams().

Here is the caller graph for this function:

static ApiBase::getBaseVersion ( ) [static]

Returns a string that identifies the version of this class.

Returns:
string

Reimplemented in ApiQueryBase, and ApiFormatBase.

Definition at line 1568 of file ApiBase.php.

Referenced by ApiMain\getVersion().

Here is the caller graph for this function:

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

Definition at line 228 of file ApiBase.php.

ApiBase::getDB ( ) [protected]
Returns:
DatabaseBase

Reimplemented in ApiQueryBase, ApiQuery, and ApiQueryAllimages.

Definition at line 1545 of file ApiBase.php.

References wfGetDB().

Here is the call graph for this function:

ApiBase::getDescription ( ) [protected]

Returns the description string for this module.

Returns:
mixed string or array of strings

Reimplemented in ApiMain, ApiQueryInfo, ApiQuery, ApiQueryRevisions, ApiQuerySiteinfo, ApiQueryRecentChanges, ApiUpload, ApiParse, ApiQueryImageInfo, ApiQueryBacklinks, ApiQueryLogEvents, ApiQueryContributions, ApiQueryWatchlist, ApiQueryCategoryMembers, ApiQueryDeletedrevs, ApiEditPage, ApiQueryAllUsers, ApiFormatBase, ApiQueryBlocks, ApiQueryUsers, ApiParamInfo, ApiQueryAllpages, ApiQuerySearch, ApiQueryFilearchive, ApiQueryAllmessages, ApiQueryCategories, ApiDelete, ApiQueryExtLinksUsage, ApiQueryUserInfo, ApiQueryAllimages, ApiQueryLinks, ApiMove, ApiFormatXml, ApiQueryProtectedTitles, ApiFeedWatchlist, ApiQueryAllLinks, ApiLogin, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiQueryAllCategories, ApiBlock, ApiFeedContributions, ApiProtect, ApiQueryWatchlistRaw, ApiQueryImages, ApiQueryQueryPage, ApiQueryTags, ApiQueryIWLinks, ApiQueryRandom, ApiQueryLangLinks, ApiQueryDuplicateFiles, ApiFileRevert, ApiPurge, ApiQueryExternalLinks, ApiQueryPageProps, ApiHelp, ApiImport, ApiQueryStashImageInfo, ApiUndelete, ApiUnblock, ApiRollback, ApiUserrights, ApiEmailUser, ApiOpenSearch, ApiFormatWddx, ApiQueryCategoryInfo, ApiComparePages, ApiExpandTemplates, ApiWatch, ApiFormatJson, ApiPatrol, ApiRsd, ApiLogout, ApiDisabled, ApiQueryDisabled, ApiFormatDump, ApiFormatDbg, ApiFormatTxt, ApiFormatPhp, and ApiFormatYaml.

Definition at line 509 of file ApiBase.php.

Referenced by getFinalDescription().

Here is the caller graph for this function:

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

Returns:
array

Definition at line 572 of file ApiBase.php.

References getDescription(), and wfRunHooks().

Referenced by makeHelpMsg().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Returns:
array

Definition at line 560 of file ApiBase.php.

References getParamDescription(), and wfRunHooks().

Referenced by makeHelpMsgParameters().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Returns:
array or false

Definition at line 548 of file ApiBase.php.

References getAllowedParams(), and wfRunHooks().

Referenced by extractRequestParams(), getParameter(), getPossibleErrors(), and makeHelpMsgParameters().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Returns:
string

Definition at line 115 of file ApiBase.php.

Referenced by ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiQueryTags\doTag(), ApiComparePages\execute(), ApiQueryStashImageInfo\execute(), ApiParse\execute(), ApiProtect\execute(), ApiUndelete\execute(), ApiEmailUser\execute(), ApiMove\execute(), ApiQueryAllUsers\execute(), ApiWatch\execute(), ApiQueryDeletedrevs\execute(), ApiQueryAllmessages\execute(), ApiImport\execute(), ApiUserrights\execute(), ApiExpandTemplates\execute(), ApiPatrol\execute(), ApiQueryFilearchive\execute(), ApiEditPage\execute(), ApiQueryUserInfo\execute(), ApiPurge\execute(), ApiHelp\execute(), ApiParamInfo\execute(), ApiUnblock\execute(), ApiQueryBlocks\execute(), ApiQueryLogEvents\execute(), ApiQueryContributions\execute(), ApiUpload\execute(), ApiFileRevert\execute(), ApiBlock\execute(), ApiRollback\execute(), ApiDelete\execute(), ApiQueryTags\execute(), ApiQueryUsers\execute(), ApiQueryRevisions\execute(), ApiQueryBacklinks\getAllowedParams(), ApiQueryBacklinks\getDescription(), ApiQueryLinks\getExamples(), ApiFormatBase\getExamples(), ApiQueryBacklinks\getExamples(), ApiQueryBacklinks\getParamDescription(), getParameterFromSettings(), ApiQueryAllLinks\getPossibleErrors(), getPossibleErrors(), ApiMain\makeHelpMsg(), ApiQuerySearch\run(), ApiQueryProtectedTitles\run(), ApiQueryLangBacklinks\run(), ApiQueryIWBacklinks\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryCategoryMembers\run(), ApiQueryAllCategories\run(), ApiQueryAllLinks\run(), ApiQueryWatchlist\run(), ApiQueryAllpages\run(), ApiQueryQueryPage\run(), ApiQueryAllimages\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryBacklinks\run(), ApiQueryRandom\runQuery(), ApiUpload\selectUploadModule(), ApiQueryBase\setContinueEnumParameter(), and setWarning().

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

Parameters:
$dbDatabaseBase
Returns:
string

Definition at line 134 of file ApiBase.php.

Referenced by profileDBIn(), profileDBOut(), profileIn(), and profileOut().

Here is the caller graph for this function:

Returns an array of parameter descriptions.

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

Returns:
array or false

Reimplemented in ApiMain, ApiPageSet, ApiQueryInfo, ApiQuery, ApiQueryRevisions, ApiQuerySiteinfo, ApiUpload, ApiQueryRecentChanges, ApiQueryImageInfo, ApiParse, ApiQueryBacklinks, ApiEditPage, ApiQueryLogEvents, ApiQueryContributions, ApiQueryWatchlist, ApiQueryDeletedrevs, ApiQueryCategoryMembers, ApiQueryAllUsers, ApiQueryUsers, ApiParamInfo, ApiQueryBlocks, ApiQueryAllpages, ApiQuerySearch, ApiQueryFilearchive, ApiQueryAllmessages, ApiQueryCategories, ApiDelete, ApiQueryLinks, ApiFormatXml, ApiQueryAllimages, ApiQueryUserInfo, ApiMove, ApiQueryExtLinksUsage, ApiFeedWatchlist, ApiQueryProtectedTitles, ApiQueryAllLinks, ApiLogin, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiFeedContributions, ApiQueryAllCategories, ApiProtect, ApiBlock, ApiQueryImages, ApiQueryWatchlistRaw, ApiQueryQueryPage, ApiQueryTags, ApiQueryIWLinks, ApiQueryRandom, ApiQueryDuplicateFiles, ApiQueryLangLinks, ApiFileRevert, ApiPurge, ApiQueryPageProps, ApiHelp, ApiQueryExternalLinks, ApiImport, ApiUndelete, ApiQueryStashImageInfo, ApiUnblock, ApiUserrights, ApiRollback, ApiEmailUser, ApiOpenSearch, ApiQueryCategoryInfo, ApiComparePages, ApiExpandTemplates, ApiWatch, ApiFormatJson, ApiPatrol, ApiRsd, ApiLogout, ApiDisabled, and ApiQueryDisabled.

Definition at line 538 of file ApiBase.php.

Referenced by getFinalParamDescription().

Here is the caller graph for this function:

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

Get a value for the given parameter.

Parameters:
$paramNamestring Parameter name
$parseLimitbool see extractRequestParams()
Returns:
mixed Parameter value

Definition at line 620 of file ApiBase.php.

References getFinalParams(), and getParameterFromSettings().

Referenced by ApiQuery\getCustomPrinter(), ApiMain\sendCacheHeaders(), ApiMain\setupExecuteAction(), and ApiMain\substituteResultWithError().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Using the settings determine the value for the given parameter.

Parameters:
$paramNameString: parameter name
$paramSettingsMixed: default value or an array of settings using PARAM_* constants.
$parseLimitBoolean: parse limit?
Returns:
mixed Parameter value

Definition at line 781 of file ApiBase.php.

References $title, dieDebug(), dieUsage(), dieUsageMsg(), encodeParamName(), getMain(), getModuleName(), ContextSource\getRequest(), getResult(), getValidNamespaces(), Title\makeTitleSafe(), PARAM_ALLOW_DUPLICATES, PARAM_DEPRECATED, PARAM_DFLT, PARAM_ISMULTI, PARAM_MAX, PARAM_MAX2, PARAM_MIN, PARAM_RANGE_ENFORCE, PARAM_REQUIRED, PARAM_TYPE, parseMultiValue(), setWarning(), validateLimit(), and validateTimestamp().

Referenced by extractRequestParams(), and getParameter().

Here is the call graph for this function:

Here is the caller graph for this function:

Total time the module used the database.

Returns:
float

Definition at line 1535 of file ApiBase.php.

References dieDebug().

Here is the call graph for this function:

Total time the module was executed.

Returns:
float

Definition at line 1486 of file ApiBase.php.

References dieDebug().

Here is the call graph for this function:

Generates the possible error requireMaxOneParameter() can die with.

Parameters:
$paramsarray
Returns:
array

Definition at line 683 of file ApiBase.php.

References getModulePrefix().

Here is the call graph for this function:

Generates the possible errors requireOnlyOneParameter() can die with.

Parameters:
$paramsarray
Returns:
array

Definition at line 650 of file ApiBase.php.

References getModulePrefix().

Referenced by ApiMove\getPossibleErrors(), ApiDelete\getPossibleErrors(), ApiQueryBlocks\getPossibleErrors(), ApiQueryCategoryMembers\getPossibleErrors(), and ApiUpload\getPossibleErrors().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the result object.

Returns:
ApiResult

Reimplemented in ApiMain.

Definition at line 163 of file ApiBase.php.

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

Referenced by ApiQueryBase\addPageSubItem(), ApiQueryBase\addPageSubItems(), ApiQuerySiteinfo\appendDbReplLagInfo(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendExtensionTags(), ApiQuerySiteinfo\appendFileExtensions(), ApiQuerySiteinfo\appendFunctionHooks(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendLanguages(), ApiQuerySiteinfo\appendMagicWords(), ApiQuerySiteinfo\appendNamespaceAliases(), ApiQuerySiteinfo\appendNamespaces(), ApiQuerySiteinfo\appendRightsInfo(), ApiQuerySiteinfo\appendSkins(), ApiQuerySiteinfo\appendSpecialPageAliases(), ApiQuerySiteinfo\appendStatistics(), ApiQuerySiteinfo\appendSubscribedHooks(), ApiQuerySiteinfo\appendUserGroups(), ApiComparePages\execute(), ApiQueryStashImageInfo\execute(), ApiParse\execute(), ApiProtect\execute(), ApiUndelete\execute(), ApiMove\execute(), ApiQueryAllUsers\execute(), ApiEmailUser\execute(), ApiQueryAllmessages\execute(), ApiQueryDeletedrevs\execute(), ApiRsd\execute(), ApiWatch\execute(), ApiImport\execute(), ApiUserrights\execute(), ApiExpandTemplates\execute(), ApiOpenSearch\execute(), ApiQueryUserInfo\execute(), ApiQueryFilearchive\execute(), ApiQueryPageProps\execute(), ApiEditPage\execute(), ApiPatrol\execute(), ApiHelp\execute(), ApiPurge\execute(), ApiParamInfo\execute(), ApiUnblock\execute(), ApiQueryContributions\execute(), ApiQueryBlocks\execute(), ApiQueryImageInfo\execute(), ApiUpload\execute(), ApiQueryLogEvents\execute(), ApiFileRevert\execute(), ApiBlock\execute(), ApiFeedContributions\execute(), ApiRollback\execute(), ApiDelete\execute(), ApiQueryTags\execute(), ApiLogin\execute(), ApiFeedWatchlist\execute(), ApiQueryUsers\execute(), ApiQueryRevisions\execute(), ApiQueryInfo\execute(), ApiQueryInfo\extractPageInfo(), ApiQueryBacklinks\extractRedirRowInfo(), ApiQueryWatchlist\extractRowInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryRevisions\extractRowInfo(), ApiParse\formatCategoryLinks(), ApiParse\formatCss(), ApiParse\formatHeadItems(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), ApiParse\formatLinks(), ApiRsd\formatRsdApiList(), ApiParamInfo\getClassInfo(), ApiQueryUserInfo\getCurrentUserInfo(), getParameterFromSettings(), getResultData(), ApiQuery\outputGeneralPageInfo(), ApiUpload\performUpload(), ApiQuerySearch\run(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryProtectedTitles\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryCategoryMembers\run(), ApiQueryAllLinks\run(), ApiQueryAllCategories\run(), ApiQueryWatchlist\run(), ApiQueryAllpages\run(), ApiQueryQueryPage\run(), ApiQueryAllimages\run(), ApiQueryRandom\run(), ApiQueryRecentChanges\run(), ApiQueryBacklinks\run(), ApiQueryRandom\runQuery(), ApiUpload\selectUploadModule(), ApiQueryBase\setContinueEnumParameter(), ApiParse\setIndexedTagNames(), setWarning(), ApiUpload\transformWarnings(), and ApiUpload\verifyUpload().

Here is the call graph for this function:

Get the result data array (read-only)

Returns:
array

Definition at line 176 of file ApiBase.php.

References getResult().

Referenced by ApiFormatPhp\execute(), ApiFormatWddx\execute(), ApiQueryImageInfo\execute(), ApiFormatDbg\execute(), ApiFormatTxt\execute(), ApiFormatDump\execute(), ApiFormatXml\execute(), ApiFormatRaw\execute(), ApiFormatJson\execute(), ApiFormatFeedWrapper\execute(), and ApiFormatRaw\getMimeType().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the token salt if there is one, '' if the module doesn't require a salt, else false if the module doesn't need a token.

Returns:
bool|string

Reimplemented in ApiUpload, ApiEditPage, ApiDelete, ApiMove, ApiProtect, ApiBlock, ApiFileRevert, ApiImport, ApiUndelete, ApiUnblock, ApiRollback, ApiEmailUser, ApiUserrights, ApiPatrol, and ApiWatch.

Definition at line 1346 of file ApiBase.php.

static ApiBase::getValidNamespaces ( ) [static]
Deprecated:
since 1.17 use MWNamespace::getValidNamespaces()
Returns:
array

Definition at line 707 of file ApiBase.php.

References wfDeprecated().

Referenced by getParameterFromSettings().

Here is the call graph for this function:

Here is the caller graph for this function:

ApiBase::getVersion ( ) [abstract]

Returns a string that identifies the version of the extending class.

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

Returns:
string

Reimplemented in ApiMain, ApiPageSet, ApiQueryInfo, ApiQuery, ApiQueryRevisions, ApiUpload, ApiQuerySiteinfo, ApiQueryRecentChanges, ApiParse, ApiQueryImageInfo, ApiQueryBacklinks, ApiEditPage, ApiQueryLogEvents, ApiQueryContributions, ApiQueryWatchlist, ApiQueryDeletedrevs, ApiQueryCategoryMembers, ApiFormatFeedWrapper, ApiQueryAllUsers, ApiResult, ApiQueryBlocks, ApiQueryAllpages, ApiQueryUsers, ApiParamInfo, ApiQuerySearch, ApiQueryFilearchive, ApiDelete, ApiQueryAllmessages, ApiQueryAllimages, ApiQueryCategories, ApiMove, ApiQueryExtLinksUsage, ApiQueryUserInfo, ApiQueryLinks, ApiFeedWatchlist, ApiQueryProtectedTitles, ApiLogin, ApiQueryAllLinks, ApiFormatXml, ApiProtect, ApiBlock, ApiQueryIWBacklinks, ApiQueryLangBacklinks, ApiFeedContributions, ApiQueryAllCategories, ApiQueryWatchlistRaw, ApiQueryImages, ApiRollback, ApiQueryQueryPage, ApiQueryIWLinks, ApiQueryLangLinks, ApiQueryTags, ApiFileRevert, ApiQueryDuplicateFiles, ApiQueryRandom, ApiFormatXmlRsd, ApiImport, ApiPurge, ApiUndelete, ApiRsd, ApiQueryExternalLinks, ApiHelp, ApiUnblock, ApiQueryPageProps, ApiEmailUser, ApiUserrights, MockApi, ApiQueryStashImageInfo, ApiComparePages, ApiOpenSearch, ApiExpandTemplates, ApiWatch, ApiQueryCategoryInfo, ApiFormatWddx, ApiPatrol, ApiFormatJson, ApiLogout, ApiFormatRaw, ApiDisabled, ApiQueryDisabled, ApiFormatDump, ApiFormatDbg, ApiFormatTxt, ApiFormatPhp, and ApiFormatYaml.

Referenced by makeHelpMsg().

Here is the caller graph for this function:

Gets the user for whom to get the watchlist.

Parameters:
$paramsarray
Returns:
User

Definition at line 1356 of file ApiBase.php.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Parameters:
$watchlistString Valid values: 'watch', 'unwatch', 'preferences', 'nochange'
$titleObjTitle the page under consideration
$userOptionString The user option to consider when $watchlist=preferences. If not set will magically default to either watchdefault or watchcreations
Returns:
bool

Definition at line 720 of file ApiBase.php.

References ContextSource\getUser().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 321 of file ApiBase.php.

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

Returns:
bool

Definition at line 155 of file ApiBase.php.

Referenced by __construct(), and getResult().

Here is the caller graph for this function:

Indicates whether this module requires read rights.

Returns:
bool

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

Definition at line 1315 of file ApiBase.php.

Referenced by getPossibleErrors(), and makeHelpMsg().

Here is the caller graph for this function:

Indicates whether this module requires write mode.

Returns:
bool

Reimplemented in ApiUpload, ApiEditPage, ApiDelete, ApiMove, ApiBlock, ApiProtect, ApiPurge, ApiFileRevert, ApiUnblock, ApiImport, ApiUndelete, ApiEmailUser, ApiUserrights, ApiRollback, ApiWatch, and ApiPatrol.

Definition at line 1322 of file ApiBase.php.

Referenced by getPossibleErrors(), and makeHelpMsg().

Here is the caller graph for this function:

ApiBase::makeHelpArrayToString ( prefix,
title,
input 
) [protected]
Parameters:
$prefixstring Text to split output items
$titlestring What is being output
$inputstring|array
Returns:
string

Definition at line 331 of file ApiBase.php.

References $input, and $title.

Referenced by makeHelpMsg().

Here is the caller graph for this function:

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

Returns:
mixed string or false

Reimplemented in ApiMain, and ApiQuery.

Definition at line 236 of file ApiBase.php.

References getExamples(), getFinalDescription(), getHelpUrls(), getMain(), getVersion(), isReadMode(), isWriteMode(), makeHelpArrayToString(), makeHelpMsgParameters(), and mustBePosted().

Here is the call graph for this function:

Callback for preg_replace_callback() call in makeHelpMsg().

Replaces a source file name with a link to ViewVC

Parameters:
$matchesarray
Returns:
string

Definition at line 474 of file ApiBase.php.

References $file, $matches, $path, $wgAutoloadClasses, and $wgAutoloadLocalClasses.

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

Returns:
string or false

Reimplemented in ApiQuery.

Definition at line 354 of file ApiBase.php.

References $t, encodeParamName(), false, getFinalParamDescription(), getFinalParams(), MWNamespace\getValidNamespaces(), PARAM_DEPRECATED, PARAM_DFLT, PARAM_REQUIRED, and PARAM_TYPE.

Referenced by makeHelpMsg().

Here is the call graph for this function:

Here is the caller graph for this function:

Indicates whether this module must be called with a POST request.

Returns:
bool

Reimplemented in ApiUpload, ApiEditPage, ApiDelete, ApiLogin, ApiMove, ApiBlock, ApiProtect, ApiFileRevert, ApiUnblock, ApiImport, ApiUndelete, ApiEmailUser, ApiUserrights, ApiRollback, ApiWatch, and ApiPatrol.

Definition at line 1330 of file ApiBase.php.

Referenced by getPossibleErrors(), and makeHelpMsg().

Here is the caller graph for this function:

Returns whether this module requires a Token to execute.

Returns:
bool

Reimplemented in ApiUpload, ApiEditPage, ApiDelete, ApiMove, ApiProtect, ApiBlock, ApiFileRevert, ApiImport, ApiUndelete, ApiUnblock, ApiRollback, ApiEmailUser, ApiUserrights, ApiPatrol, and ApiWatch.

Definition at line 1338 of file ApiBase.php.

Referenced by getPossibleErrors().

Here is the caller graph for this function:

ApiBase::parameterNotEmpty ( x) [private]

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

Parameters:
$xobject Parameter to check is not null/false
Returns:
bool

Definition at line 698 of file ApiBase.php.

ApiBase::parseErrors ( errors)

Parses a list of errors into a standardised format.

Parameters:
$errorsarray List of errors. Items can be in the for array( key, param1, param2, ... ) or array( 'code' => ..., 'info' => ... )
Returns:
array Parsed list of errors with items in the form array( 'code' => ..., 'info' => ... )

Definition at line 1424 of file ApiBase.php.

References parseMsg().

Referenced by ApiParamInfo\getClassInfo().

Here is the call graph for this function:

Here is the caller graph for this function:

ApiBase::parseMsg ( error)

Return the error message related to a certain array.

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

Definition at line 1271 of file ApiBase.php.

References wfMsgReplaceArgs().

Referenced by dieReadOnly(), ApiUpload\dieRecoverableError(), dieUsageMsg(), ApiMove\execute(), ApiPurge\execute(), ApiMove\moveSubpages(), and parseErrors().

Here is the call graph for this function:

Here is the caller graph for this function:

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:
$valueNamestring The name of the parameter (for error reporting)
$valuemixed The value being parsed
$allowMultiplebool Can $value contain more than one value separated by '|'?
$allowedValuesmixed An array of values to check against. If null, all values are accepted.
Returns:
mixed (allowMultiple ? an_array_of_values : a_single_value)

Definition at line 947 of file ApiBase.php.

References dieUsage(), LIMIT_SML1, and setWarning().

Referenced by getParameterFromSettings().

Here is the call graph for this function:

Here is the caller graph for this function:

Start module profiling.

Definition at line 1445 of file ApiBase.php.

References dieDebug(), getModuleProfileName(), and wfProfileIn().

Referenced by ApiPageSet\execute(), ApiMain\execute(), ApiPageSet\finishPageSetGeneration(), ApiPageSet\populateFromPageIDs(), ApiPageSet\populateFromQueryResult(), ApiPageSet\populateFromRevisionIDs(), and ApiPageSet\populateFromTitles().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
$paramsarray

Definition at line 665 of file ApiBase.php.

References dieUsage().

Referenced by ApiQueryBlocks\execute().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
$paramsarray of parameter names

Definition at line 630 of file ApiBase.php.

References dieUsage().

Referenced by ApiMove\execute(), ApiDelete\execute(), ApiQueryCategoryMembers\run(), and ApiUpload\selectUploadModule().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References profileDBOut(), and profileOut().

Here is the call graph for this function:

ApiBase::setWarning ( warning)

Set warning section for this module.

Users should monitor this section to notice any changes in API. Multiple calls to this function will result in the warning messages being separated by newlines

Parameters:
$warningstring Warning message

Definition at line 201 of file ApiBase.php.

References $result, getModuleName(), getResult(), and ApiResult\setContent().

Referenced by ApiResult\addValue(), ApiFormatXml\addXslt(), ApiPurge\execute(), ApiQueryDisabled\execute(), ApiQueryUsers\execute(), ApiQueryRevisions\execute(), ApiPageSet\execute(), ApiQueryInfo\extractPageInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryRevisions\extractRowInfo(), getParameterFromSettings(), ApiQueryImageInfo\mergeThumbParams(), parseMultiValue(), ApiQueryImages\run(), ApiQueryCategories\run(), ApiQueryLinks\run(), and warnOrDie().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Parameters:
$watchString Valid values: 'watch', 'unwatch', 'preferences', 'nochange'
$titleObjTitle the article's title to change
$userOptionString The user option to consider when $watch=preferences

Definition at line 758 of file ApiBase.php.

References $user, WatchAction\doUnwatch(), WatchAction\doWatch(), ContextSource\getUser(), and getWatchlistValue().

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

Here is the call graph for this function:

Here is the caller graph for this function:

Indicates if this module needs maxlag to be checked.

Returns:
bool

Reimplemented in ApiQuery, and ApiHelp.

Definition at line 1307 of file ApiBase.php.

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

Truncate an array to a certain length.

Parameters:
$arrarray Array to truncate
$limitint Maximum length
Returns:
bool True if the array was truncated, false otherwise

Definition at line 1063 of file ApiBase.php.

References $limit.

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

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

Prints usage info on failure.

Parameters:
$paramNamestring Parameter name
$valueint Parameter value
$minint|null Minimum value
$maxint|null Maximum value for users
$botMaxint Maximum value for sysops/bots
$enforceLimitsBoolean Whether to enforce (die) if value is outside limits

Definition at line 1000 of file ApiBase.php.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

ApiBase::validateTimestamp ( value,
paramName 
)
Parameters:
$valuestring
$paramNamestring
Returns:
string

Definition at line 1035 of file ApiBase.php.

References dieUsage(), and wfTimestamp().

Referenced by getParameterFromSettings().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Adds a warning to the output, else dies.

Parameters:
$msgString Message to show as a warning, or error message if dying
$enforceLimitsBoolean Whether this is an enforce (die)

Definition at line 1049 of file ApiBase.php.

References dieUsage(), and setWarning().

Referenced by validateLimit().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

ApiBase::$mDBTime = 0

Definition at line 1496 of file ApiBase.php.

ApiBase::$mDBTimeIn = 0 [private]

Profiling: database execution time.

Definition at line 1496 of file ApiBase.php.

ApiBase::$messageMap [static]

Array that maps message keys to error messages.

$1 and friends are replaced.

Definition at line 1091 of file ApiBase.php.

ApiBase::$mMainModule [private]

Definition at line 62 of file ApiBase.php.

ApiBase::$mModuleName

Definition at line 62 of file ApiBase.php.

ApiBase::$mModulePrefix

Definition at line 62 of file ApiBase.php.

ApiBase::$mModuleTime = 0

Definition at line 1440 of file ApiBase.php.

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

Definition at line 63 of file ApiBase.php.

ApiBase::$mTimeIn = 0 [private]

Profiling: total module execution time.

Definition at line 1440 of file ApiBase.php.

Definition at line 46 of file ApiBase.php.

Referenced by ApiQueryStashImageInfo\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiRollback\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiFileRevert\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiMove\getAllowedParams(), ApiFeedWatchlist\getAllowedParams(), ApiQueryAllimages\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiDelete\getAllowedParams(), ApiQueryAllpages\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllmessages\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiEditPage\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiParse\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiUpload\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), ApiQueryInfo\getAllowedParams(), ApiMain\getAllowedParams(), ApiParamInfo\getClassInfo(), getParameterFromSettings(), and makeHelpMsgParameters().

Definition at line 47 of file ApiBase.php.

Referenced by ApiQueryStashImageInfo\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiHelp\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiQueryAllimages\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiQueryAllpages\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllmessages\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiParamInfo\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiParse\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), ApiQuery\getAllowedParams(), ApiQueryInfo\getAllowedParams(), ApiPageSet\getAllowedParams(), ApiParamInfo\getClassInfo(), and getParameterFromSettings().

Definition at line 55 of file ApiBase.php.

Referenced by getParameterFromSettings().

Definition at line 48 of file ApiBase.php.

Referenced by ApiPatrol\getAllowedParams(), ApiQueryStashImageInfo\getAllowedParams(), ApiExpandTemplates\getAllowedParams(), ApiRollback\getAllowedParams(), ApiWatch\getAllowedParams(), ApiComparePages\getAllowedParams(), ApiOpenSearch\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiEmailUser\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiImport\getAllowedParams(), ApiUnblock\getAllowedParams(), ApiQueryExternalLinks\getAllowedParams(), ApiFileRevert\getAllowedParams(), ApiQueryLangLinks\getAllowedParams(), ApiQueryDuplicateFiles\getAllowedParams(), ApiQueryWatchlistRaw\getAllowedParams(), ApiQueryIWLinks\getAllowedParams(), ApiQueryTags\getAllowedParams(), ApiProtect\getAllowedParams(), ApiQueryAllCategories\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiFeedContributions\getAllowedParams(), ApiQueryExtLinksUsage\getAllowedParams(), ApiQueryImages\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiBlock\getAllowedParams(), ApiQueryProtectedTitles\getAllowedParams(), ApiQueryIWBacklinks\getAllowedParams(), ApiQueryLangBacklinks\getAllowedParams(), ApiQueryAllLinks\getAllowedParams(), ApiMove\getAllowedParams(), ApiFeedWatchlist\getAllowedParams(), ApiQueryAllimages\getAllowedParams(), ApiQueryUserInfo\getAllowedParams(), ApiQueryCategories\getAllowedParams(), ApiQueryLinks\getAllowedParams(), ApiDelete\getAllowedParams(), ApiQueryAllpages\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryAllmessages\getAllowedParams(), ApiQueryFilearchive\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiParamInfo\getAllowedParams(), ApiQueryCategoryMembers\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryAllUsers\getAllowedParams(), ApiQueryWatchlist\getAllowedParams(), ApiQueryContributions\getAllowedParams(), ApiQueryLogEvents\getAllowedParams(), ApiEditPage\getAllowedParams(), ApiQueryBacklinks\getAllowedParams(), ApiQueryImageInfo\getAllowedParams(), ApiParse\getAllowedParams(), ApiQueryRecentChanges\getAllowedParams(), ApiQueryRevisions\getAllowedParams(), ApiUpload\getAllowedParams(), ApiQuerySiteinfo\getAllowedParams(), ApiQuery\getAllowedParams(), ApiQueryInfo\getAllowedParams(), ApiPageSet\getAllowedParams(), ApiMain\getAllowedParams(), ApiParamInfo\getClassInfo(), getParameterFromSettings(), and makeHelpMsgParameters().


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