MediaWiki
REL1_22
|
This is the main query class. More...
Public Member Functions | |
__construct ($main, $action) | |
execute () | |
Query execution happens in the following steps: #1 Create a PageSet object with any pages requested by the user #2 If using a generator, execute it to get a new ApiPageSet object #3 Instantiate all requested modules. | |
getAllowedParams ($flags=0) | |
getCustomPrinter () | |
getDescription () | |
Returns the description string for this module. | |
getExamples () | |
Returns usage examples for this module. | |
getGenerators () | |
Get the generators array mapping module names to class names. | |
getHelpUrls () | |
getModuleManager () | |
Overrides to return this instance's module manager. | |
getModules () | |
Get the array mapping module names to class names. | |
getModuleType ($moduleName) | |
Get whether the specified module is a prop, list or a meta query module. | |
getNamedDB ($name, $db, $groups) | |
Get the query database connection with the given name. | |
getPageSet () | |
Gets the set of pages the user has requested (or generated) | |
getParamDescription () | |
Returns an array of parameter descriptions. | |
getPossibleErrors () | |
Returns a list of all possible errors returned by the module. | |
makeHelpMsg () | |
Override the parent to generate help messages for all available query modules. | |
setGeneratorContinue ($module, $paramName, $paramValue) | |
This method is called by the generator base when generator in the smart-continue mode tries to set 'query-continue' value. | |
shouldCheckMaxlag () | |
Indicates if this module needs maxlag to be checked. | |
Protected Member Functions | |
mergeCacheMode ($cacheMode, $modCacheMode) | |
Update a cache mode string, applying the cache mode of a new module to it. | |
Private Member Functions | |
doExport ($pageSet, $result) | |
initContinue (&$pagesetParams, &$completeModules) | |
Parse 'continue' parameter into the list of complete modules and a list of generator parameters. | |
initModules ($allModules, $completeModules, $usePageset) | |
Validate sub-modules, filter out completed ones, and do requestExtraData() | |
instantiateModules (&$modules, $param) | |
Create instances of all modules requested by the client. | |
makeHelpMsgHelper ($group) | |
For all modules of a given group, generate help messages and join them together. | |
outputGeneralPageInfo () | |
Appends an element for each page in the current pageSet with the most general information (id, title), plus any title normalizations and missing or invalid title/pageids/revids. | |
Private Attributes | |
$mGeneratorContinue | |
$mModuleMgr | |
$mNamedDB = array() | |
ApiPageSet | $mPageSet |
$mParams | |
$mUseLegacyContinue | |
Static Private Attributes | |
static | $QueryListModules |
static | $QueryMetaModules |
static | $QueryPropModules |
This is the main query class.
It behaves similar to ApiMain: based on the parameters given, it will create a list of titles to work on (an ApiPageSet object), instantiate and execute various property/list/meta modules, and assemble all resulting data into a single ApiResult object.
In generator mode, a generator will be executed first to populate a second ApiPageSet object, and that object will be used for all subsequent modules.
Definition at line 38 of file ApiQuery.php.
ApiQuery::__construct | ( | $ | main, |
$ | action | ||
) |
$main | ApiMain |
$action | string |
Definition at line 123 of file ApiQuery.php.
ApiQuery::doExport | ( | $ | pageSet, |
$ | result | ||
) | [private] |
$pageSet | ApiPageSet Pages to be exported |
$result | ApiResult Result to output to |
Definition at line 575 of file ApiQuery.php.
Query execution happens in the following steps: #1 Create a PageSet object with any pages requested by the user #2 If using a generator, execute it to get a new ApiPageSet object #3 Instantiate all requested modules.
This way the PageSet object will know what shared data is required, and minimize DB calls. #4 Output all normalization and redirect resolution information #5 Execute all requested modules
Reimplemented from ApiBase.
Definition at line 237 of file ApiQuery.php.
ApiQuery::getAllowedParams | ( | $ | flags = 0 | ) |
Definition at line 617 of file ApiQuery.php.
References $flags, $result, array(), getPageSet(), ApiBase\PARAM_ISMULTI, and ApiBase\PARAM_TYPE.
Returns the description string for this module.
Reimplemented from ApiBase.
Definition at line 715 of file ApiQuery.php.
References array().
Returns usage examples for this module.
Return false if no examples are available.
Reimplemented from ApiBase.
Definition at line 730 of file ApiQuery.php.
References array().
Get the generators array mapping module names to class names.
Definition at line 191 of file ApiQuery.php.
Reimplemented from ApiBase.
Definition at line 737 of file ApiQuery.php.
References array().
Overrides to return this instance's module manager.
Reimplemented from ApiBase.
Definition at line 145 of file ApiQuery.php.
Get the array mapping module names to class names.
Definition at line 181 of file ApiQuery.php.
ApiQuery::getModuleType | ( | $ | moduleName | ) |
Get whether the specified module is a prop, list or a meta query module.
string | $moduleName | Name of the module to find type for |
Definition at line 208 of file ApiQuery.php.
ApiQuery::getNamedDB | ( | $ | name, |
$ | db, | ||
$ | groups | ||
) |
Get the query database connection with the given name.
If no such connection has been requested before, it will be created. Subsequent calls with the same $name will return the same connection as the first, regardless of the values of $db and $groups
string | $name | Name to assign to the database connection |
int | $db | One of the DB_* constants |
array | $groups | Query groups |
Definition at line 159 of file ApiQuery.php.
Gets the set of pages the user has requested (or generated)
Definition at line 172 of file ApiQuery.php.
Referenced by getAllowedParams(), getParamDescription(), and getPossibleErrors().
Returns an array of parameter descriptions.
Don't call this function directly: use getFinalParamDescription() to allow hooks to modify descriptions as needed.
Reimplemented from ApiBase.
Definition at line 699 of file ApiQuery.php.
References array(), and getPageSet().
Returns a list of all possible errors returned by the module.
Don't call this function directly: use getFinalPossibleErrors() to allow hooks to modify parameters as needed.
Reimplemented from ApiBase.
Definition at line 723 of file ApiQuery.php.
References ApiBase\getFinalPossibleErrors(), and getPageSet().
ApiQuery::initContinue | ( | &$ | pagesetParams, |
&$ | completeModules | ||
) | [private] |
Parse 'continue' parameter into the list of complete modules and a list of generator parameters.
array | null | $pagesetParams | returns list of generator params or null if pageset is done |
array | null | $completeModules | returns list of finished modules (as keys), or null if legacy |
Definition at line 346 of file ApiQuery.php.
ApiQuery::initModules | ( | $ | allModules, |
$ | completeModules, | ||
$ | usePageset | ||
) | [private] |
Validate sub-modules, filter out completed ones, and do requestExtraData()
array | $allModules | An dict of name=>instance of all modules requested by the client |
array | null | $completeModules | list of finished modules, or null if legacy continue |
bool | $usePageset | True if pageset will be executed |
Definition at line 382 of file ApiQuery.php.
ApiQuery::instantiateModules | ( | &$ | modules, |
$ | param | ||
) | [private] |
Create instances of all modules requested by the client.
array | $modules | to append instantiated modules to |
string | $param | Parameter name to read modules from |
Definition at line 439 of file ApiQuery.php.
Override the parent to generate help messages for all available query modules.
Reimplemented from ApiBase.
Definition at line 647 of file ApiQuery.php.
ApiQuery::makeHelpMsgHelper | ( | $ | group | ) | [private] |
For all modules of a given group, generate help messages and join them together.
string | $group | Module group |
Definition at line 670 of file ApiQuery.php.
ApiQuery::mergeCacheMode | ( | $ | cacheMode, |
$ | modCacheMode | ||
) | [protected] |
Update a cache mode string, applying the cache mode of a new module to it.
The cache mode may increase in the level of privacy, but public modules added to private data do not decrease the level of privacy.
$cacheMode | string |
$modCacheMode | string |
Definition at line 421 of file ApiQuery.php.
ApiQuery::outputGeneralPageInfo | ( | ) | [private] |
Appends an element for each page in the current pageSet with the most general information (id, title), plus any title normalizations and missing or invalid title/pageids/revids.
Definition at line 459 of file ApiQuery.php.
ApiQuery::setGeneratorContinue | ( | $ | module, |
$ | paramName, | ||
$ | paramValue | ||
) |
This method is called by the generator base when generator in the smart-continue mode tries to set 'query-continue' value.
ApiQuery stores those values separately until the post-processing when it is known if the generation should continue or repeat.
ApiQueryGeneratorBase | $module | generator module |
string | $paramName | |
mixed | $paramValue |
Definition at line 559 of file ApiQuery.php.
Indicates if this module needs maxlag to be checked.
Reimplemented from ApiBase.
Definition at line 695 of file ApiQuery.php.
ApiQuery::$mGeneratorContinue [private] |
Definition at line 116 of file ApiQuery.php.
ApiQuery::$mModuleMgr [private] |
Definition at line 115 of file ApiQuery.php.
ApiQuery::$mNamedDB = array() [private] |
Definition at line 114 of file ApiQuery.php.
ApiPageSet ApiQuery::$mPageSet [private] |
Definition at line 111 of file ApiQuery.php.
ApiQuery::$mParams [private] |
Definition at line 113 of file ApiQuery.php.
ApiQuery::$mUseLegacyContinue [private] |
Definition at line 117 of file ApiQuery.php.
ApiQuery::$QueryListModules [static, private] |
Definition at line 65 of file ApiQuery.php.
ApiQuery::$QueryMetaModules [static, private] |
array( 'allmessages' => 'ApiQueryAllMessages', 'siteinfo' => 'ApiQuerySiteinfo', 'userinfo' => 'ApiQueryUserInfo', 'filerepoinfo' => 'ApiQueryFileRepoInfo', )
Definition at line 102 of file ApiQuery.php.
ApiQuery::$QueryPropModules [static, private] |
array( 'categories' => 'ApiQueryCategories', 'categoryinfo' => 'ApiQueryCategoryInfo', 'duplicatefiles' => 'ApiQueryDuplicateFiles', 'extlinks' => 'ApiQueryExternalLinks', 'images' => 'ApiQueryImages', 'imageinfo' => 'ApiQueryImageInfo', 'info' => 'ApiQueryInfo', 'links' => 'ApiQueryLinks', 'iwlinks' => 'ApiQueryIWLinks', 'langlinks' => 'ApiQueryLangLinks', 'pageprops' => 'ApiQueryPageProps', 'revisions' => 'ApiQueryRevisions', 'stashimageinfo' => 'ApiQueryStashImageInfo', 'templates' => 'ApiQueryLinks', )
Definition at line 44 of file ApiQuery.php.