MediaWiki  REL1_22
ApiQueryInfo Class Reference

A query module to show basic page information. More...

Inheritance diagram for ApiQueryInfo:
Collaboration diagram for ApiQueryInfo:

List of all members.

Public Member Functions

 __construct ($query, $moduleName)
 execute ()
 Evaluates the parameters, performs the requested query, and sets up the result.
 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.
 getCacheMode ($params)
 Get the cache mode for the data generated by this module.
 getDescription ()
 Returns the description string for this module.
 getExamples ()
 Returns usage examples for this module.
 getHelpUrls ()
 getParamDescription ()
 Returns an array of parameter descriptions.
 getResultProperties ()
 Returns possible properties in the result, grouped by the value of the prop parameter that shows them.
 requestExtraData ($pageSet)

Static Public Member Functions

static getBlockToken ($pageid, $title)
static getDeleteToken ($pageid, $title)
static getEditToken ($pageid, $title)
static getEmailToken ($pageid, $title)
static getImportToken ($pageid, $title)
static getMoveToken ($pageid, $title)
static getOptionsToken ($pageid, $title)
static getProtectToken ($pageid, $title)
static getUnblockToken ($pageid, $title)
static getWatchToken ($pageid, $title)
static resetTokenCache ()

Public Attributes

 $displaytitles
 $everything
 $fld_displaytitle = false
 $fld_notificationtimestamp = false
 $fld_preload = false
 $fld_readable = false
 $fld_subjectid = false
 $fld_talkid = false
 $fld_url = false
 $fld_watched = false
 $fld_watchers = false
 $missing
 $notificationtimestamps
 $pageCounter
 $pageIsNew
 $pageIsRedir
 $pageLatest
 $pageLength
 $pageTouched
 $subjectids
 $talkids
 $titles
 $watched
 $watchers

Static Public Attributes

static $cachedTokens = array()

Protected Member Functions

 getTokenFunctions ()
 Get an array mapping token names to their handler functions.

Private Member Functions

 extractPageInfo ($pageid, $title)
 Get a result array with information about a title.
 getDisplayTitle ()
 getProtectionInfo ()
 Get information about protections and put it in $protections.
 getTSIDs ()
 Get talk page IDs (if requested) and subject page IDs (if requested) and put them in $talkids and $subjectids.
 getWatchedInfo ()
 Get information about watched status and put it in $this->watched and $this->notificationtimestamps.
 getWatcherInfo ()
 Get the count of watchers and put it in $this->watchers.

Private Attributes

 $fld_protection = false
 $pageRestrictions
 $params
 $protections
 $showZeroWatchers = false
 $tokenFunctions

Detailed Description

A query module to show basic page information.

Definition at line 32 of file ApiQueryInfo.php.


Constructor & Destructor Documentation

ApiQueryInfo::__construct ( query,
moduleName 
)

Definition at line 50 of file ApiQueryInfo.php.

References $query.


Member Function Documentation

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 from ApiBase.

Definition at line 250 of file ApiQueryInfo.php.

References $result, $title, $wgDisableCounters, array(), as, Title\compare(), ApiBase\dieContinueUsageIf(), extractPageInfo(), ApiBase\extractRequestParams(), getDisplayTitle(), ApiQueryBase\getPageSet(), getProtectionInfo(), ApiBase\getResult(), getTSIDs(), getWatchedInfo(), getWatcherInfo(), global, Title\makeTitleSafe(), params, and ApiQueryBase\setContinueEnumParameter().

ApiQueryInfo::extractPageInfo ( pageid,
title 
) [private]

Get a result array with information about a title.

Parameters:
int$pageidPage ID (negative for missing titles)
$titleTitle object
Returns:
array

Definition at line 349 of file ApiQueryInfo.php.

References $t, $title, $tokenFunctions, $wgDisableCounters, array(), as, ApiBase\getResult(), getTokenFunctions(), global, params, ApiBase\setWarning(), wfExpandUrl(), wfRunHooks(), and wfTimestamp().

Referenced by execute().

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 from ApiBase.

Definition at line 767 of file ApiQueryInfo.php.

References array(), getTokenFunctions(), ApiBase\PARAM_DFLT, ApiBase\PARAM_ISMULTI, and ApiBase\PARAM_TYPE.

static ApiQueryInfo::getBlockToken ( pageid,
title 
) [static]

Definition at line 175 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

Referenced by getUnblockToken().

Get the cache mode for the data generated by this module.

Override this in the module subclass. For possible return values and other details about cache modes, see ApiMain::setCacheMode()

Public caching will only be allowed if *all* the modules that supply data for a given request return a cache mode of public.

Parameters:
$params
Returns:
string

Reimplemented from ApiQueryBase.

Definition at line 745 of file ApiQueryInfo.php.

References $params, array(), and as.

static ApiQueryInfo::getDeleteToken ( pageid,
title 
) [static]

Definition at line 133 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

Returns the description string for this module.

Returns:
mixed string or array of strings

Reimplemented from ApiBase.

Definition at line 881 of file ApiQueryInfo.php.

static ApiQueryInfo::getEditToken ( pageid,
title 
) [static]

Definition at line 116 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

static ApiQueryInfo::getEmailToken ( pageid,
title 
) [static]

Definition at line 194 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

Returns usage examples for this module.

Return false if no examples are available.

Returns:
bool|string|array

Reimplemented from ApiBase.

Definition at line 885 of file ApiQueryInfo.php.

References array().

Returns:
bool|string|array Returns a false if the module has no help url, else returns a (array of) string

Reimplemented from ApiBase.

Definition at line 892 of file ApiQueryInfo.php.

static ApiQueryInfo::getImportToken ( pageid,
title 
) [static]

Definition at line 208 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

static ApiQueryInfo::getMoveToken ( pageid,
title 
) [static]

Definition at line 161 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

static ApiQueryInfo::getOptionsToken ( pageid,
title 
) [static]

Definition at line 236 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

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 from ApiBase.

Definition at line 795 of file ApiQueryInfo.php.

References array().

static ApiQueryInfo::getProtectToken ( pageid,
title 
) [static]

Definition at line 147 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

Returns possible properties in the result, grouped by the value of the prop parameter that shows them.

Properties that are shown always are in a group with empty string as a key. Properties that can be shown by several values of prop are included multiple times. If some properties are part of a list and some are on the root object (see ApiQueryQueryPage), those on the root object are under the key PROP_ROOT. The array can also contain a boolean under the key PROP_LIST, indicating whether the result is a list.

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

Returns:
array|bool False on no properties

Reimplemented from ApiBase.

Definition at line 815 of file ApiQueryInfo.php.

References ApiBase\addTokenProperties(), array(), getTokenFunctions(), ApiBase\PROP_LIST, ApiBase\PROP_NULLABLE, and ApiBase\PROP_TYPE.

Get an array mapping token names to their handler functions.

The prototype for a token function is func($pageid, $title) it should return a token or false (permission denied)

Returns:
array array(tokenname => function)

Definition at line 84 of file ApiQueryInfo.php.

References array(), ApiBase\getMain(), ContextSource\getRequest(), and wfRunHooks().

Referenced by extractPageInfo(), getAllowedParams(), and getResultProperties().

ApiQueryInfo::getTSIDs ( ) [private]

Get talk page IDs (if requested) and subject page IDs (if requested) and put them in $talkids and $subjectids.

Definition at line 606 of file ApiQueryInfo.php.

References $lb, $res, $t, ApiQueryBase\addFields(), ApiQueryBase\addTables(), ApiQueryBase\addWhere(), array(), as, ApiQueryBase\getDB(), MWNamespace\getSubject(), MWNamespace\getTalk(), MWNamespace\isTalk(), ApiQueryBase\resetQueryParams(), and ApiQueryBase\select().

Referenced by execute().

static ApiQueryInfo::getUnblockToken ( pageid,
title 
) [static]

Definition at line 189 of file ApiQueryInfo.php.

References $title, and getBlockToken().

Get information about watched status and put it in $this->watched and $this->notificationtimestamps.

Definition at line 669 of file ApiQueryInfo.php.

References $lb, $res, $user, ApiQueryBase\addFields(), ApiQueryBase\addFieldsIf(), ApiQueryBase\addTables(), ApiQueryBase\addWhere(), array(), as, ApiQueryBase\getDB(), ContextSource\getUser(), ApiQueryBase\resetQueryParams(), and ApiQueryBase\select().

Referenced by execute().

static ApiQueryInfo::getWatchToken ( pageid,
title 
) [static]

Definition at line 222 of file ApiQueryInfo.php.

References $cachedTokens, $wgUser, and global.

Referenced by ResourceLoaderUserTokensModule\contextUserTokens().

Parameters:
$pageSetApiPageSet
Returns:
void

Reimplemented from ApiQueryBase.

Definition at line 58 of file ApiQueryInfo.php.

References $wgDisableCounters, and global.

static ApiQueryInfo::resetTokenCache ( ) [static]

Definition at line 112 of file ApiQueryInfo.php.

References $cachedTokens, and array().

Referenced by ApiLogin\execute(), and ApiTestCase\setUp().


Member Data Documentation

ApiQueryInfo::$displaytitles

Definition at line 45 of file ApiQueryInfo.php.

ApiQueryInfo::$everything

Definition at line 40 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_displaytitle = false

Definition at line 38 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_notificationtimestamp = false

Definition at line 37 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_preload = false

Definition at line 38 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_protection = false [private]

Definition at line 34 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_readable = false

Definition at line 36 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_subjectid = false

Definition at line 35 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_talkid = false

Definition at line 34 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_url = false

Definition at line 35 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_watched = false

Definition at line 36 of file ApiQueryInfo.php.

ApiQueryInfo::$fld_watchers = false

Definition at line 36 of file ApiQueryInfo.php.

ApiQueryInfo::$missing

Definition at line 40 of file ApiQueryInfo.php.

ApiQueryInfo::$notificationtimestamps

Definition at line 45 of file ApiQueryInfo.php.

ApiQueryInfo::$pageCounter

Definition at line 40 of file ApiQueryInfo.php.

ApiQueryInfo::$pageIsNew

Definition at line 42 of file ApiQueryInfo.php.

ApiQueryInfo::$pageIsRedir

Definition at line 42 of file ApiQueryInfo.php.

ApiQueryInfo::$pageLatest

Definition at line 42 of file ApiQueryInfo.php.

ApiQueryInfo::$pageLength

Definition at line 42 of file ApiQueryInfo.php.

ApiQueryInfo::$pageRestrictions [private]

Definition at line 42 of file ApiQueryInfo.php.

ApiQueryInfo::$pageTouched

Definition at line 42 of file ApiQueryInfo.php.

ApiQueryInfo::$params [private]

Definition at line 40 of file ApiQueryInfo.php.

Referenced by getCacheMode().

ApiQueryInfo::$protections [private]

Definition at line 45 of file ApiQueryInfo.php.

ApiQueryInfo::$showZeroWatchers = false [private]

Definition at line 46 of file ApiQueryInfo.php.

ApiQueryInfo::$subjectids

Definition at line 45 of file ApiQueryInfo.php.

ApiQueryInfo::$talkids

Definition at line 45 of file ApiQueryInfo.php.

ApiQueryInfo::$titles

Definition at line 40 of file ApiQueryInfo.php.

ApiQueryInfo::$tokenFunctions [private]

Definition at line 48 of file ApiQueryInfo.php.

Referenced by extractPageInfo().

ApiQueryInfo::$watched

Definition at line 45 of file ApiQueryInfo.php.

ApiQueryInfo::$watchers

Definition at line 45 of file ApiQueryInfo.php.


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