MediaWiki  master
ApiQuery.php
Go to the documentation of this file.
1 <?php
25 
37 class ApiQuery extends ApiBase {
38 
42  private const QUERY_PROP_MODULES = [
43  'categories' => ApiQueryCategories::class,
44  'categoryinfo' => ApiQueryCategoryInfo::class,
45  'contributors' => ApiQueryContributors::class,
46  'deletedrevisions' => ApiQueryDeletedRevisions::class,
47  'duplicatefiles' => ApiQueryDuplicateFiles::class,
48  'extlinks' => ApiQueryExternalLinks::class,
49  'fileusage' => ApiQueryBacklinksprop::class,
50  'images' => ApiQueryImages::class,
51  'imageinfo' => ApiQueryImageInfo::class,
52  'info' => [
53  'class' => ApiQueryInfo::class,
54  'services' => [
55  'ContentLanguage',
56  'LinkBatchFactory',
57  'NamespaceInfo',
58  'TitleFactory',
59  'WatchedItemStore',
60  ],
61  ],
62  'links' => ApiQueryLinks::class,
63  'linkshere' => ApiQueryBacklinksprop::class,
64  'iwlinks' => ApiQueryIWLinks::class,
65  'langlinks' => ApiQueryLangLinks::class,
66  'pageprops' => ApiQueryPageProps::class,
67  'redirects' => ApiQueryBacklinksprop::class,
68  'revisions' => ApiQueryRevisions::class,
69  'stashimageinfo' => ApiQueryStashImageInfo::class,
70  'templates' => ApiQueryLinks::class,
71  'transcludedin' => ApiQueryBacklinksprop::class,
72  ];
73 
77  private const QUERY_LIST_MODULES = [
78  'allcategories' => ApiQueryAllCategories::class,
79  'alldeletedrevisions' => ApiQueryAllDeletedRevisions::class,
80  'allfileusages' => ApiQueryAllLinks::class,
81  'allimages' => ApiQueryAllImages::class,
82  'alllinks' => ApiQueryAllLinks::class,
83  'allpages' => ApiQueryAllPages::class,
84  'allredirects' => ApiQueryAllLinks::class,
85  'allrevisions' => ApiQueryAllRevisions::class,
86  'mystashedfiles' => ApiQueryMyStashedFiles::class,
87  'alltransclusions' => ApiQueryAllLinks::class,
88  'allusers' => ApiQueryAllUsers::class,
89  'backlinks' => ApiQueryBacklinks::class,
90  'blocks' => [
91  'class' => ApiQueryBlocks::class,
92  'services' => [
93  'BlockActionInfo',
94  'BlockRestrictionStore',
95  'CommentStore',
96  'UserNameUtils',
97  ],
98  ],
99  'categorymembers' => ApiQueryCategoryMembers::class,
100  'deletedrevs' => [
101  'class' => ApiQueryDeletedrevs::class,
102  'services' => [
103  'CommentStore',
104  ],
105  ],
106  'embeddedin' => ApiQueryBacklinks::class,
107  'exturlusage' => ApiQueryExtLinksUsage::class,
108  'filearchive' => [
109  'class' => ApiQueryFilearchive::class,
110  'services' => [
111  'CommentStore',
112  ],
113  ],
114  'imageusage' => ApiQueryBacklinks::class,
115  'iwbacklinks' => ApiQueryIWBacklinks::class,
116  'langbacklinks' => ApiQueryLangBacklinks::class,
117  'logevents' => [
118  'class' => ApiQueryLogEvents::class,
119  'services' => [
120  'CommentStore',
121  ],
122  ],
123  'pageswithprop' => ApiQueryPagesWithProp::class,
124  'pagepropnames' => ApiQueryPagePropNames::class,
125  'prefixsearch' => ApiQueryPrefixSearch::class,
126  'protectedtitles' => [
127  'class' => ApiQueryProtectedTitles::class,
128  'services' => [
129  'CommentStore',
130  ],
131  ],
132  'querypage' => ApiQueryQueryPage::class,
133  'random' => ApiQueryRandom::class,
134  'recentchanges' => [
135  'class' => ApiQueryRecentChanges::class,
136  'services' => [
137  'CommentStore',
138  ],
139  ],
140  'search' => ApiQuerySearch::class,
141  'tags' => ApiQueryTags::class,
142  'usercontribs' => [
143  'class' => ApiQueryUserContribs::class,
144  'services' => [
145  'CommentStore',
146  'UserIdentityLookup',
147  'UserNameUtils',
148  ],
149  ],
150  'users' => [
151  'class' => ApiQueryUsers::class,
152  'services' => [
153  'UserNameUtils',
154  ],
155  ],
156  'watchlist' => [
157  'class' => ApiQueryWatchlist::class,
158  'services' => [
159  'CommentStore',
160  ],
161  ],
162  'watchlistraw' => ApiQueryWatchlistRaw::class,
163  ];
164 
168  private const QUERY_META_MODULES = [
169  'allmessages' => ApiQueryAllMessages::class,
170  'authmanagerinfo' => ApiQueryAuthManagerInfo::class,
171  'siteinfo' => [
172  'class' => ApiQuerySiteinfo::class,
173  'services' => [
174  'UserOptionsLookup',
175  ]
176  ],
177  'userinfo' => [
178  'class' => ApiQueryUserInfo::class,
179  'services' => [
180  'TalkPageNotificationManager',
181  'WatchedItemStore',
182  'UserEditTracker',
183  'UserOptionsLookup',
184  'UserGroupManager',
185  ]
186  ],
187  'filerepoinfo' => ApiQueryFileRepoInfo::class,
188  'tokens' => ApiQueryTokens::class,
189  'languageinfo' => [
190  'class' => ApiQueryLanguageinfo::class,
191  'services' => [
192  'LanguageFactory',
193  'LanguageNameUtils',
194  'LanguageFallback',
195  'LanguageConverterFactory',
196  ],
197  ],
198  ];
199 
203  private $mPageSet;
204 
205  private $mParams;
206  private $mNamedDB = [];
207  private $mModuleMgr;
208 
213  public function __construct( ApiMain $main, $action ) {
214  parent::__construct( $main, $action );
215 
216  $this->mModuleMgr = new ApiModuleManager(
217  $this,
218  MediaWikiServices::getInstance()->getObjectFactory()
219  );
220 
221  // Allow custom modules to be added in LocalSettings.php
222  $config = $this->getConfig();
223  $this->mModuleMgr->addModules( self::QUERY_PROP_MODULES, 'prop' );
224  $this->mModuleMgr->addModules( $config->get( 'APIPropModules' ), 'prop' );
225  $this->mModuleMgr->addModules( self::QUERY_LIST_MODULES, 'list' );
226  $this->mModuleMgr->addModules( $config->get( 'APIListModules' ), 'list' );
227  $this->mModuleMgr->addModules( self::QUERY_META_MODULES, 'meta' );
228  $this->mModuleMgr->addModules( $config->get( 'APIMetaModules' ), 'meta' );
229 
230  $this->getHookRunner()->onApiQuery__moduleManager( $this->mModuleMgr );
231 
232  // Create PageSet that will process titles/pageids/revids/generator
233  $this->mPageSet = new ApiPageSet( $this );
234  }
235 
240  public function getModuleManager() {
241  return $this->mModuleMgr;
242  }
243 
254  public function getNamedDB( $name, $db, $groups ) {
255  if ( !array_key_exists( $name, $this->mNamedDB ) ) {
256  $this->mNamedDB[$name] = wfGetDB( $db, $groups );
257  }
258 
259  return $this->mNamedDB[$name];
260  }
261 
266  public function getPageSet() {
267  return $this->mPageSet;
268  }
269 
273  public function getCustomPrinter() {
274  // If &exportnowrap is set, use the raw formatter
275  if ( $this->getParameter( 'export' ) &&
276  $this->getParameter( 'exportnowrap' )
277  ) {
278  return new ApiFormatRaw( $this->getMain(),
279  $this->getMain()->createPrinterByName( 'xml' ) );
280  } else {
281  return null;
282  }
283  }
284 
295  public function execute() {
296  $this->mParams = $this->extractRequestParams();
297 
298  // Instantiate requested modules
299  $allModules = [];
300  $this->instantiateModules( $allModules, 'prop' );
301  $propModules = array_keys( $allModules );
302  $this->instantiateModules( $allModules, 'list' );
303  $this->instantiateModules( $allModules, 'meta' );
304 
305  // Filter modules based on continue parameter
306  $continuationManager = new ApiContinuationManager( $this, $allModules, $propModules );
307  $this->setContinuationManager( $continuationManager );
309  $modules = $continuationManager->getRunModules();
310  '@phan-var ApiQueryBase[] $modules';
311 
312  if ( !$continuationManager->isGeneratorDone() ) {
313  // Query modules may optimize data requests through the $this->getPageSet()
314  // object by adding extra fields from the page table.
315  foreach ( $modules as $module ) {
316  $module->requestExtraData( $this->mPageSet );
317  }
318  // Populate page/revision information
319  $this->mPageSet->execute();
320  // Record page information (title, namespace, if exists, etc)
321  $this->outputGeneralPageInfo();
322  } else {
323  $this->mPageSet->executeDryRun();
324  }
325 
326  $cacheMode = $this->mPageSet->getCacheMode();
327 
328  // Execute all unfinished modules
329  foreach ( $modules as $module ) {
330  $params = $module->extractRequestParams();
331  $cacheMode = $this->mergeCacheMode(
332  $cacheMode, $module->getCacheMode( $params ) );
333  $module->execute();
334  $this->getHookRunner()->onAPIQueryAfterExecute( $module );
335  }
336 
337  // Set the cache mode
338  $this->getMain()->setCacheMode( $cacheMode );
339 
340  // Write the continuation data into the result
341  $this->setContinuationManager( null );
342  if ( $this->mParams['rawcontinue'] ) {
343  $data = $continuationManager->getRawNonContinuation();
344  if ( $data ) {
345  $this->getResult()->addValue( null, 'query-noncontinue', $data,
347  }
348  $data = $continuationManager->getRawContinuation();
349  if ( $data ) {
350  $this->getResult()->addValue( null, 'query-continue', $data,
352  }
353  } else {
354  $continuationManager->setContinuationIntoResult( $this->getResult() );
355  }
356  }
357 
367  protected function mergeCacheMode( $cacheMode, $modCacheMode ) {
368  if ( $modCacheMode === 'anon-public-user-private' ) {
369  if ( $cacheMode !== 'private' ) {
370  $cacheMode = 'anon-public-user-private';
371  }
372  } elseif ( $modCacheMode === 'public' ) {
373  // do nothing, if it's public already it will stay public
374  } else {
375  $cacheMode = 'private';
376  }
377 
378  return $cacheMode;
379  }
380 
386  private function instantiateModules( &$modules, $param ) {
387  $wasPosted = $this->getRequest()->wasPosted();
388  if ( isset( $this->mParams[$param] ) ) {
389  foreach ( $this->mParams[$param] as $moduleName ) {
390  $instance = $this->mModuleMgr->getModule( $moduleName, $param );
391  if ( $instance === null ) {
392  ApiBase::dieDebug( __METHOD__, 'Error instantiating module' );
393  }
394  if ( !$wasPosted && $instance->mustBePosted() ) {
395  $this->dieWithErrorOrDebug( [ 'apierror-mustbeposted', $moduleName ] );
396  }
397  // Ignore duplicates. TODO 2.0: die()?
398  if ( !array_key_exists( $moduleName, $modules ) ) {
399  $modules[$moduleName] = $instance;
400  }
401  }
402  }
403  }
404 
410  private function outputGeneralPageInfo() {
411  $pageSet = $this->getPageSet();
412  $result = $this->getResult();
413 
414  // We can't really handle max-result-size failure here, but we need to
415  // check anyway in case someone set the limit stupidly low.
416  $fit = true;
417 
418  $values = $pageSet->getNormalizedTitlesAsResult( $result );
419  if ( $values ) {
420  // @phan-suppress-next-line PhanRedundantCondition
421  $fit = $fit && $result->addValue( 'query', 'normalized', $values );
422  }
423  $values = $pageSet->getConvertedTitlesAsResult( $result );
424  if ( $values ) {
425  $fit = $fit && $result->addValue( 'query', 'converted', $values );
426  }
427  $values = $pageSet->getInterwikiTitlesAsResult( $result, $this->mParams['iwurl'] );
428  if ( $values ) {
429  $fit = $fit && $result->addValue( 'query', 'interwiki', $values );
430  }
431  $values = $pageSet->getRedirectTitlesAsResult( $result );
432  if ( $values ) {
433  $fit = $fit && $result->addValue( 'query', 'redirects', $values );
434  }
435  $values = $pageSet->getMissingRevisionIDsAsResult( $result );
436  if ( $values ) {
437  $fit = $fit && $result->addValue( 'query', 'badrevids', $values );
438  }
439 
440  // Page elements
441  $pages = [];
442 
443  // Report any missing titles
444  foreach ( $pageSet->getMissingTitles() as $fakeId => $title ) {
445  $vals = [];
447  $vals['missing'] = true;
448  if ( $title->isKnown() ) {
449  $vals['known'] = true;
450  }
451  $pages[$fakeId] = $vals;
452  }
453  // Report any invalid titles
454  foreach ( $pageSet->getInvalidTitlesAndReasons() as $fakeId => $data ) {
455  $pages[$fakeId] = $data + [ 'invalid' => true ];
456  }
457  // Report any missing page ids
458  foreach ( $pageSet->getMissingPageIDs() as $pageid ) {
459  $pages[$pageid] = [
460  'pageid' => $pageid,
461  'missing' => true,
462  ];
463  }
464  // Report special pages
466  foreach ( $pageSet->getSpecialTitles() as $fakeId => $title ) {
467  $vals = [];
469  $vals['special'] = true;
470  if ( !$title->isKnown() ) {
471  $vals['missing'] = true;
472  }
473  $pages[$fakeId] = $vals;
474  }
475 
476  // Output general page information for found titles
477  foreach ( $pageSet->getGoodTitles() as $pageid => $title ) {
478  $vals = [];
479  $vals['pageid'] = $pageid;
481  $pages[$pageid] = $vals;
482  }
483 
484  if ( count( $pages ) ) {
485  $pageSet->populateGeneratorData( $pages );
486  ApiResult::setArrayType( $pages, 'BCarray' );
487 
488  if ( $this->mParams['indexpageids'] ) {
489  $pageIDs = array_keys( ApiResult::stripMetadataNonRecursive( $pages ) );
490  // json treats all map keys as strings - converting to match
491  $pageIDs = array_map( 'strval', $pageIDs );
492  ApiResult::setIndexedTagName( $pageIDs, 'id' );
493  $fit = $fit && $result->addValue( 'query', 'pageids', $pageIDs );
494  }
495 
496  ApiResult::setIndexedTagName( $pages, 'page' );
497  $fit = $fit && $result->addValue( 'query', 'pages', $pages );
498  }
499 
500  if ( !$fit ) {
501  $this->dieWithError( 'apierror-badconfig-resulttoosmall', 'badconfig' );
502  }
503 
504  if ( $this->mParams['export'] ) {
505  $this->doExport( $pageSet, $result );
506  }
507  }
508 
513  private function doExport( $pageSet, $result ) {
514  $exportTitles = [];
515  $titles = $pageSet->getGoodPages();
516  if ( count( $titles ) ) {
518  foreach ( $titles as $title ) {
519  if ( $this->getAuthority()->authorizeRead( 'read', $title ) ) {
520  $exportTitles[] = $title;
521  }
522  }
523  }
524 
525  $exporter = new WikiExporter( $this->getDB() );
526  $sink = new DumpStringOutput;
527  $exporter->setOutputSink( $sink );
528  $exporter->setSchemaVersion( $this->mParams['exportschema'] );
529  $exporter->openStream();
530  foreach ( $exportTitles as $title ) {
531  $exporter->pageByTitle( $title );
532  }
533  $exporter->closeStream();
534 
535  // Don't check the size of exported stuff
536  // It's not continuable, so it would cause more
537  // problems than it'd solve
538  if ( $this->mParams['exportnowrap'] ) {
539  $result->reset();
540  // Raw formatter will handle this
541  $result->addValue( null, 'text', $sink, ApiResult::NO_SIZE_CHECK );
542  $result->addValue( null, 'mime', 'text/xml', ApiResult::NO_SIZE_CHECK );
543  $result->addValue( null, 'filename', 'export.xml', ApiResult::NO_SIZE_CHECK );
544  } else {
545  $result->addValue( 'query', 'export', $sink, ApiResult::NO_SIZE_CHECK );
546  $result->addValue( 'query', ApiResult::META_BC_SUBELEMENTS, [ 'export' ] );
547  }
548  }
549 
550  public function getAllowedParams( $flags = 0 ) {
551  $result = [
552  'prop' => [
553  ApiBase::PARAM_ISMULTI => true,
554  ApiBase::PARAM_TYPE => 'submodule',
555  ],
556  'list' => [
557  ApiBase::PARAM_ISMULTI => true,
558  ApiBase::PARAM_TYPE => 'submodule',
559  ],
560  'meta' => [
561  ApiBase::PARAM_ISMULTI => true,
562  ApiBase::PARAM_TYPE => 'submodule',
563  ],
564  'indexpageids' => false,
565  'export' => false,
566  'exportnowrap' => false,
567  'exportschema' => [
570  ],
571  'iwurl' => false,
572  'continue' => [
573  ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
574  ],
575  'rawcontinue' => false,
576  ];
577  if ( $flags ) {
578  $result += $this->getPageSet()->getFinalParams( $flags );
579  }
580 
581  return $result;
582  }
583 
584  public function isReadMode() {
585  // We need to make an exception for certain meta modules that should be
586  // accessible even without the 'read' right. Restrict the exception as
587  // much as possible: no other modules allowed, and no pageset
588  // parameters either. We do allow the 'rawcontinue' and 'indexpageids'
589  // parameters since frameworks might add these unconditionally and they
590  // can't expose anything here.
591  $allowedParams = [ 'rawcontinue' => 1, 'indexpageids' => 1 ];
592  $this->mParams = $this->extractRequestParams();
593  $request = $this->getRequest();
594  foreach ( $this->mParams + $this->getPageSet()->extractRequestParams() as $param => $value ) {
595  $needed = $param === 'meta';
596  if ( !isset( $allowedParams[$param] ) && $request->getCheck( $param ) !== $needed ) {
597  return true;
598  }
599  }
600 
601  // Ask each module if it requires read mode. Any true => this returns
602  // true.
603  $modules = [];
604  $this->instantiateModules( $modules, 'meta' );
605  foreach ( $modules as $module ) {
606  if ( $module->isReadMode() ) {
607  return true;
608  }
609  }
610 
611  return false;
612  }
613 
614  protected function getExamplesMessages() {
615  return [
616  'action=query&prop=revisions&meta=siteinfo&' .
617  'titles=Main%20Page&rvprop=user|comment&continue='
618  => 'apihelp-query-example-revisions',
619  'action=query&generator=allpages&gapprefix=API/&prop=revisions&continue='
620  => 'apihelp-query-example-allpages',
621  ];
622  }
623 
624  public function getHelpUrls() {
625  return [
626  'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Query',
627  'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Meta',
628  'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Properties',
629  'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Lists',
630  ];
631  }
632 }
ApiMain
This is the main API class, used for both external and internal processing.
Definition: ApiMain.php:48
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:71
ApiQuery\isReadMode
isReadMode()
Indicates whether this module requires read rights.
Definition: ApiQuery.php:584
WikiExporter\schemaVersion
static schemaVersion()
Returns the default export schema version, as defined by $wgXmlDumpSchemaVersion.
Definition: WikiExporter.php:96
ApiQuery\$mParams
$mParams
Definition: ApiQuery.php:205
ApiQuery
This is the main query class.
Definition: ApiQuery.php:37
ApiQuery\getPageSet
getPageSet()
Gets the set of pages the user has requested (or generated)
Definition: ApiQuery.php:266
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:180
ApiContinuationManager
This manages continuation state.
Definition: ApiContinuationManager.php:26
ApiBase\dieWithError
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition: ApiBase.php:1382
ApiBase\PARAM_HELP_MSG
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition: ApiBase.php:105
true
return true
Definition: router.php:90
ApiResult\META_BC_SUBELEMENTS
const META_BC_SUBELEMENTS
Key for the 'BC subelements' metadata item.
Definition: ApiResult.php:143
ApiBase\PARAM_TYPE
const PARAM_TYPE
Definition: ApiBase.php:72
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:571
ApiBase\dieWithErrorOrDebug
dieWithErrorOrDebug( $msg, $code=null, $data=null, $httpCode=null)
Will only set a warning instead of failing if the global $wgDebugAPI is set to true.
Definition: ApiBase.php:1547
ApiBase\setContinuationManager
setContinuationManager(ApiContinuationManager $manager=null)
Definition: ApiBase.php:615
ApiQuery\QUERY_LIST_MODULES
const QUERY_LIST_MODULES
List of Api Query list modules.
Definition: ApiQuery.php:77
ApiBase\getDB
getDB()
Gets a default replica DB connection object.
Definition: ApiBase.php:594
ApiResult\NO_SIZE_CHECK
const NO_SIZE_CHECK
For addValue() and similar functions, do not check size while adding a value Don't use this unless yo...
Definition: ApiResult.php:58
ContextSource\getRequest
getRequest()
Definition: ContextSource.php:80
XmlDumpWriter\$supportedSchemas
static string[] $supportedSchemas
the schema versions supported for output @final
Definition: XmlDumpWriter.php:57
ApiQuery\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.
Definition: ApiQuery.php:624
ApiPageSet
This class contains a list of pages that the client has requested.
Definition: ApiPageSet.php:45
ApiBase
This abstract class implements many basic API functions, and is the base of all API classes.
Definition: ApiBase.php:55
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
ApiQuery\QUERY_META_MODULES
const QUERY_META_MODULES
List of Api Query meta modules.
Definition: ApiQuery.php:168
ApiQuery\__construct
__construct(ApiMain $main, $action)
Definition: ApiQuery.php:213
ApiResult\setArrayType
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
Definition: ApiResult.php:719
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2306
$modules
$modules
Definition: HTMLFormElement.php:15
ApiFormatRaw
Formatter that spits out anything you like with any desired MIME type.
Definition: ApiFormatRaw.php:27
ApiQuery\getNamedDB
getNamedDB( $name, $db, $groups)
Get the query database connection with the given name.
Definition: ApiQuery.php:254
ApiBase\extractRequestParams
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:718
ApiResult\stripMetadataNonRecursive
static stripMetadataNonRecursive( $data, &$metadata=null)
Remove metadata keys from a data array or object, non-recursive.
Definition: ApiResult.php:1049
$title
$title
Definition: testCompression.php:38
WikiExporter
Definition: WikiExporter.php:41
ApiModuleManager
This class holds a list of modules and handles instantiation.
Definition: ApiModuleManager.php:33
ApiResult\setIndexedTagName
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:607
ContextSource\getAuthority
getAuthority()
Definition: ContextSource.php:143
ApiQuery\doExport
doExport( $pageSet, $result)
Definition: ApiQuery.php:513
ApiQuery\getModuleManager
getModuleManager()
Overrides to return this instance's module manager.
Definition: ApiQuery.php:240
Title
Represents a title within MediaWiki.
Definition: Title.php:49
ApiQuery\getCustomPrinter
getCustomPrinter()
Definition: ApiQuery.php:273
ApiResult\ADD_ON_TOP
const ADD_ON_TOP
For addValue(), setValue() and similar functions, if the value does not exist, add it as the first el...
Definition: ApiResult.php:49
ApiQuery\QUERY_PROP_MODULES
const QUERY_PROP_MODULES
List of Api Query prop modules.
Definition: ApiQuery.php:42
ApiQuery\mergeCacheMode
mergeCacheMode( $cacheMode, $modCacheMode)
Update a cache mode string, applying the cache mode of a new module to it.
Definition: ApiQuery.php:367
ApiQuery\$mPageSet
ApiPageSet $mPageSet
Definition: ApiQuery.php:203
ApiBase\PARAM_DFLT
const PARAM_DFLT
Definition: ApiBase.php:70
ApiQuery\outputGeneralPageInfo
outputGeneralPageInfo()
Appends an element for each page in the current pageSet with the most general information (id,...
Definition: ApiQuery.php:410
ApiQuery\getAllowedParams
getAllowedParams( $flags=0)
Definition: ApiQuery.php:550
ApiBase\getParameter
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
Definition: ApiBase.php:838
ApiQuery\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.
Definition: ApiQuery.php:614
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
Definition: ApiBase.php:71
ApiQuery\$mModuleMgr
$mModuleMgr
Definition: ApiQuery.php:207
ApiBase\getMain
getMain()
Get the main module.
Definition: ApiBase.php:456
ApiBase\getHookRunner
getHookRunner()
Get an ApiHookRunner for running core API hooks.
Definition: ApiBase.php:664
ApiQuery\execute
execute()
Query execution happens in the following steps: #1 Create a PageSet object with any pages requested b...
Definition: ApiQuery.php:295
ApiBase\dieDebug
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
Definition: ApiBase.php:1577
ApiQuery\$mNamedDB
$mNamedDB
Definition: ApiQuery.php:206
DumpStringOutput
Definition: DumpStringOutput.php:27
ApiQuery\instantiateModules
instantiateModules(&$modules, $param)
Create instances of all modules requested by the client.
Definition: ApiQuery.php:386
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:466