5 * Created on Sep 7, 2006
7 * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
28 * This is the main query class. It behaves similar to ApiMain: based on the
29 * parameters given, it will create a list of titles to work on (an ApiPageSet
30 * object), instantiate and execute various property/list/meta modules, and
31 * assemble all resulting data into a single ApiResult object.
33 * In generator mode, a generator will be executed first to populate a second
34 * ApiPageSet object, and that object will be used for all subsequent modules.
38 class ApiQuery
extends ApiBase
{
41 * List of Api Query prop modules
44 private static $QueryPropModules = array(
45 'categories' => 'ApiQueryCategories',
46 'categoryinfo' => 'ApiQueryCategoryInfo',
47 'contributors' => 'ApiQueryContributors',
48 'duplicatefiles' => 'ApiQueryDuplicateFiles',
49 'extlinks' => 'ApiQueryExternalLinks',
50 'images' => 'ApiQueryImages',
51 'imageinfo' => 'ApiQueryImageInfo',
52 'info' => 'ApiQueryInfo',
53 'links' => 'ApiQueryLinks',
54 'iwlinks' => 'ApiQueryIWLinks',
55 'langlinks' => 'ApiQueryLangLinks',
56 'pageprops' => 'ApiQueryPageProps',
57 'redirects' => 'ApiQueryRedirects',
58 'revisions' => 'ApiQueryRevisions',
59 'stashimageinfo' => 'ApiQueryStashImageInfo',
60 'templates' => 'ApiQueryLinks',
64 * List of Api Query list modules
67 private static $QueryListModules = array(
68 'allcategories' => 'ApiQueryAllCategories',
69 'allfileusages' => 'ApiQueryAllLinks',
70 'allimages' => 'ApiQueryAllImages',
71 'alllinks' => 'ApiQueryAllLinks',
72 'allpages' => 'ApiQueryAllPages',
73 'allredirects' => 'ApiQueryAllLinks',
74 'alltransclusions' => 'ApiQueryAllLinks',
75 'allusers' => 'ApiQueryAllUsers',
76 'backlinks' => 'ApiQueryBacklinks',
77 'blocks' => 'ApiQueryBlocks',
78 'categorymembers' => 'ApiQueryCategoryMembers',
79 'deletedrevs' => 'ApiQueryDeletedrevs',
80 'embeddedin' => 'ApiQueryBacklinks',
81 'exturlusage' => 'ApiQueryExtLinksUsage',
82 'filearchive' => 'ApiQueryFilearchive',
83 'imageusage' => 'ApiQueryBacklinks',
84 'iwbacklinks' => 'ApiQueryIWBacklinks',
85 'langbacklinks' => 'ApiQueryLangBacklinks',
86 'logevents' => 'ApiQueryLogEvents',
87 'pageswithprop' => 'ApiQueryPagesWithProp',
88 'pagepropnames' => 'ApiQueryPagePropNames',
89 'protectedtitles' => 'ApiQueryProtectedTitles',
90 'querypage' => 'ApiQueryQueryPage',
91 'random' => 'ApiQueryRandom',
92 'recentchanges' => 'ApiQueryRecentChanges',
93 'search' => 'ApiQuerySearch',
94 'tags' => 'ApiQueryTags',
95 'usercontribs' => 'ApiQueryContributions',
96 'users' => 'ApiQueryUsers',
97 'watchlist' => 'ApiQueryWatchlist',
98 'watchlistraw' => 'ApiQueryWatchlistRaw',
102 * List of Api Query meta modules
105 private static $QueryMetaModules = array(
106 'allmessages' => 'ApiQueryAllMessages',
107 'siteinfo' => 'ApiQuerySiteinfo',
108 'userinfo' => 'ApiQueryUserInfo',
109 'filerepoinfo' => 'ApiQueryFileRepoInfo',
118 private $mNamedDB = array();
120 private $mGeneratorContinue;
121 private $mUseLegacyContinue;
124 * @param $main ApiMain
125 * @param $action string
127 public function __construct( $main, $action ) {
128 parent
::__construct( $main, $action );
130 $this->mModuleMgr
= new ApiModuleManager( $this );
132 // Allow custom modules to be added in LocalSettings.php
133 global $wgAPIPropModules, $wgAPIListModules, $wgAPIMetaModules;
134 $this->mModuleMgr
->addModules( self
::$QueryPropModules, 'prop' );
135 $this->mModuleMgr
->addModules( $wgAPIPropModules, 'prop' );
136 $this->mModuleMgr
->addModules( self
::$QueryListModules, 'list' );
137 $this->mModuleMgr
->addModules( $wgAPIListModules, 'list' );
138 $this->mModuleMgr
->addModules( self
::$QueryMetaModules, 'meta' );
139 $this->mModuleMgr
->addModules( $wgAPIMetaModules, 'meta' );
141 // Create PageSet that will process titles/pageids/revids/generator
142 $this->mPageSet
= new ApiPageSet( $this );
146 * Overrides to return this instance's module manager.
147 * @return ApiModuleManager
149 public function getModuleManager() {
150 return $this->mModuleMgr
;
154 * Get the query database connection with the given name.
155 * If no such connection has been requested before, it will be created.
156 * Subsequent calls with the same $name will return the same connection
157 * as the first, regardless of the values of $db and $groups
158 * @param string $name Name to assign to the database connection
159 * @param int $db One of the DB_* constants
160 * @param array $groups Query groups
161 * @return DatabaseBase
163 public function getNamedDB( $name, $db, $groups ) {
164 if ( !array_key_exists( $name, $this->mNamedDB
) ) {
165 $this->profileDBIn();
166 $this->mNamedDB
[$name] = wfGetDB( $db, $groups );
167 $this->profileDBOut();
170 return $this->mNamedDB
[$name];
174 * Gets the set of pages the user has requested (or generated)
177 public function getPageSet() {
178 return $this->mPageSet
;
182 * Get the array mapping module names to class names
183 * @deprecated since 1.21, use getModuleManager()'s methods instead
184 * @return array array(modulename => classname)
186 public function getModules() {
187 wfDeprecated( __METHOD__
, '1.21' );
189 return $this->getModuleManager()->getNamesWithClasses();
193 * Get the generators array mapping module names to class names
194 * @deprecated since 1.21, list of generators is maintained by ApiPageSet
195 * @return array array(modulename => classname)
197 public function getGenerators() {
198 wfDeprecated( __METHOD__
, '1.21' );
200 foreach ( $this->mModuleMgr
->getNamesWithClasses() as $name => $class ) {
201 if ( is_subclass_of( $class, 'ApiQueryGeneratorBase' ) ) {
202 $gens[$name] = $class;
210 * Get whether the specified module is a prop, list or a meta query module
211 * @deprecated since 1.21, use getModuleManager()->getModuleGroup()
212 * @param string $moduleName Name of the module to find type for
213 * @return mixed string or null
215 function getModuleType( $moduleName ) {
216 return $this->getModuleManager()->getModuleGroup( $moduleName );
220 * @return ApiFormatRaw|null
222 public function getCustomPrinter() {
223 // If &exportnowrap is set, use the raw formatter
224 if ( $this->getParameter( 'export' ) &&
225 $this->getParameter( 'exportnowrap' )
227 return new ApiFormatRaw( $this->getMain(),
228 $this->getMain()->createPrinterByName( 'xml' ) );
235 * Query execution happens in the following steps:
236 * #1 Create a PageSet object with any pages requested by the user
237 * #2 If using a generator, execute it to get a new ApiPageSet object
238 * #3 Instantiate all requested modules.
239 * This way the PageSet object will know what shared data is required,
240 * and minimize DB calls.
241 * #4 Output all normalization and redirect resolution information
242 * #5 Execute all requested modules
244 public function execute() {
245 $this->mParams
= $this->extractRequestParams();
247 // $pagesetParams is a array of parameter names used by the pageset generator
248 // or null if pageset has already finished and is no longer needed
249 // $completeModules is a set of complete modules with the name as key
250 $this->initContinue( $pagesetParams, $completeModules );
252 // Instantiate requested modules
253 $allModules = array();
254 $this->instantiateModules( $allModules, 'prop' );
255 $propModules = $allModules; // Keep a copy
256 $this->instantiateModules( $allModules, 'list' );
257 $this->instantiateModules( $allModules, 'meta' );
259 // Filter modules based on continue parameter
260 $modules = $this->initModules( $allModules, $completeModules, $pagesetParams !== null );
262 // Execute pageset if in legacy mode or if pageset is not done
263 if ( $completeModules === null ||
$pagesetParams !== null ) {
264 // Populate page/revision information
265 $this->mPageSet
->execute();
266 // Record page information (title, namespace, if exists, etc)
267 $this->outputGeneralPageInfo();
269 $this->mPageSet
->executeDryRun();
272 $cacheMode = $this->mPageSet
->getCacheMode();
274 // Execute all unfinished modules
275 /** @var $module ApiQueryBase */
276 foreach ( $modules as $module ) {
277 $params = $module->extractRequestParams();
278 $cacheMode = $this->mergeCacheMode(
279 $cacheMode, $module->getCacheMode( $params ) );
280 $module->profileIn();
282 wfRunHooks( 'APIQueryAfterExecute', array( &$module ) );
283 $module->profileOut();
286 // Set the cache mode
287 $this->getMain()->setCacheMode( $cacheMode );
289 if ( $completeModules === null ) {
290 return; // Legacy continue, we are done
293 // Reformat query-continue result section
294 $result = $this->getResult();
295 $qc = $result->getData();
296 if ( isset( $qc['query-continue'] ) ) {
297 $qc = $qc['query-continue'];
298 $result->unsetValue( null, 'query-continue' );
299 } elseif ( $this->mGeneratorContinue
!== null ) {
302 // no more "continue"s, we are done!
306 // we are done with all the modules that do not have result in query-continue
307 $completeModules = array_merge( $completeModules, array_diff_key( $modules, $qc ) );
308 if ( $pagesetParams !== null ) {
309 // The pageset is still in use, check if all props have finished
310 $incompleteProps = array_intersect_key( $propModules, $qc );
311 if ( count( $incompleteProps ) > 0 ) {
312 // Properties are not done, continue with the same pageset state - copy current parameters
313 $main = $this->getMain();
314 $contValues = array();
315 foreach ( $pagesetParams as $param ) {
316 // The param name is already prefix-encoded
317 $contValues[$param] = $main->getVal( $param );
319 } elseif ( $this->mGeneratorContinue
!== null ) {
320 // Move to the next set of pages produced by pageset, properties need to be restarted
321 $contValues = $this->mGeneratorContinue
;
322 $pagesetParams = array_keys( $contValues );
323 $completeModules = array_diff_key( $completeModules, $propModules );
325 // Done with the pageset, finish up with the the lists and meta modules
326 $pagesetParams = null;
330 $continue = '||' . implode( '|', array_keys( $completeModules ) );
331 if ( $pagesetParams !== null ) {
332 // list of all pageset parameters to use in the next request
333 $continue = implode( '|', $pagesetParams ) . $continue;
335 // we are done with the pageset
336 $contValues = array();
337 $continue = '-' . $continue;
339 $contValues['continue'] = $continue;
340 foreach ( $qc as $qcModule ) {
341 foreach ( $qcModule as $qcKey => $qcValue ) {
342 $contValues[$qcKey] = $qcValue;
345 $this->getResult()->addValue( null, 'continue', $contValues );
349 * Parse 'continue' parameter into the list of complete modules and a list of generator parameters
350 * @param array|null $pagesetParams returns list of generator params or null if pageset is done
351 * @param array|null $completeModules returns list of finished modules (as keys), or null if legacy
353 private function initContinue( &$pagesetParams, &$completeModules ) {
354 $pagesetParams = array();
355 $continue = $this->mParams
['continue'];
356 if ( $continue !== null ) {
357 $this->mUseLegacyContinue
= false;
358 if ( $continue !== '' ) {
359 // Format: ' pagesetParam1 | pagesetParam2 || module1 | module2 | module3 | ...
360 // If pageset is done, use '-'
361 $continue = explode( '||', $continue );
362 $this->dieContinueUsageIf( count( $continue ) !== 2 );
363 if ( $continue[0] === '-' ) {
364 $pagesetParams = null; // No need to execute pageset
365 } elseif ( $continue[0] !== '' ) {
366 // list of pageset params that might need to be repeated
367 $pagesetParams = explode( '|', $continue[0] );
369 $continue = $continue[1];
371 if ( $continue !== '' ) {
372 $completeModules = array_flip( explode( '|', $continue ) );
374 $completeModules = array();
377 $this->mUseLegacyContinue
= true;
378 $completeModules = null;
383 * Validate sub-modules, filter out completed ones, and do requestExtraData()
384 * @param array $allModules An dict of name=>instance of all modules requested by the client
385 * @param array|null $completeModules list of finished modules, or null if legacy continue
386 * @param bool $usePageset True if pageset will be executed
387 * @return array of modules to be processed during this execution
389 private function initModules( $allModules, $completeModules, $usePageset ) {
390 $modules = $allModules;
391 $tmp = $completeModules;
392 $wasPosted = $this->getRequest()->wasPosted();
394 /** @var $module ApiQueryBase */
395 foreach ( $allModules as $moduleName => $module ) {
396 if ( !$wasPosted && $module->mustBePosted() ) {
397 $this->dieUsageMsgOrDebug( array( 'mustbeposted', $moduleName ) );
399 if ( $completeModules !== null && array_key_exists( $moduleName, $completeModules ) ) {
400 // If this module is done, mark all its params as used
401 $module->extractRequestParams();
402 // Make sure this module is not used during execution
403 unset( $modules[$moduleName] );
404 unset( $tmp[$moduleName] );
405 } elseif ( $completeModules === null ||
$usePageset ) {
406 // Query modules may optimize data requests through the $this->getPageSet()
407 // object by adding extra fields from the page table.
408 // This function will gather all the extra request fields from the modules.
409 $module->requestExtraData( $this->mPageSet
);
411 // Error - this prop module must have finished before generator is done
412 $this->dieContinueUsageIf( $this->mModuleMgr
->getModuleGroup( $moduleName ) === 'prop' );
415 $this->dieContinueUsageIf( $completeModules !== null && count( $tmp ) !== 0 );
421 * Update a cache mode string, applying the cache mode of a new module to it.
422 * The cache mode may increase in the level of privacy, but public modules
423 * added to private data do not decrease the level of privacy.
425 * @param $cacheMode string
426 * @param $modCacheMode string
429 protected function mergeCacheMode( $cacheMode, $modCacheMode ) {
430 if ( $modCacheMode === 'anon-public-user-private' ) {
431 if ( $cacheMode !== 'private' ) {
432 $cacheMode = 'anon-public-user-private';
434 } elseif ( $modCacheMode === 'public' ) {
435 // do nothing, if it's public already it will stay public
437 $cacheMode = 'private';
444 * Create instances of all modules requested by the client
445 * @param array $modules to append instantiated modules to
446 * @param string $param Parameter name to read modules from
448 private function instantiateModules( &$modules, $param ) {
449 if ( isset( $this->mParams
[$param] ) ) {
450 foreach ( $this->mParams
[$param] as $moduleName ) {
451 $instance = $this->mModuleMgr
->getModule( $moduleName, $param );
452 if ( $instance === null ) {
453 ApiBase
::dieDebug( __METHOD__
, 'Error instantiating module' );
455 // Ignore duplicates. TODO 2.0: die()?
456 if ( !array_key_exists( $moduleName, $modules ) ) {
457 $modules[$moduleName] = $instance;
464 * Appends an element for each page in the current pageSet with the
465 * most general information (id, title), plus any title normalizations
466 * and missing or invalid title/pageids/revids.
468 private function outputGeneralPageInfo() {
469 $pageSet = $this->getPageSet();
470 $result = $this->getResult();
472 // We don't check for a full result set here because we can't be adding
473 // more than 380K. The maximum revision size is in the megabyte range,
474 // and the maximum result size must be even higher than that.
476 $values = $pageSet->getNormalizedTitlesAsResult( $result );
478 $result->addValue( 'query', 'normalized', $values );
480 $values = $pageSet->getConvertedTitlesAsResult( $result );
482 $result->addValue( 'query', 'converted', $values );
484 $values = $pageSet->getInterwikiTitlesAsResult( $result, $this->mParams
['iwurl'] );
486 $result->addValue( 'query', 'interwiki', $values );
488 $values = $pageSet->getRedirectTitlesAsResult( $result );
490 $result->addValue( 'query', 'redirects', $values );
492 $values = $pageSet->getMissingRevisionIDsAsResult( $result );
494 $result->addValue( 'query', 'badrevids', $values );
500 // Report any missing titles
501 foreach ( $pageSet->getMissingTitles() as $fakeId => $title ) {
503 ApiQueryBase
::addTitleInfo( $vals, $title );
504 $vals['missing'] = '';
505 $pages[$fakeId] = $vals;
507 // Report any invalid titles
508 foreach ( $pageSet->getInvalidTitles() as $fakeId => $title ) {
509 $pages[$fakeId] = array( 'title' => $title, 'invalid' => '' );
511 // Report any missing page ids
512 foreach ( $pageSet->getMissingPageIDs() as $pageid ) {
513 $pages[$pageid] = array(
518 // Report special pages
519 /** @var $title Title */
520 foreach ( $pageSet->getSpecialTitles() as $fakeId => $title ) {
522 ApiQueryBase
::addTitleInfo( $vals, $title );
523 $vals['special'] = '';
524 if ( $title->isSpecialPage() &&
525 !SpecialPageFactory
::exists( $title->getDBkey() )
527 $vals['missing'] = '';
528 } elseif ( $title->getNamespace() == NS_MEDIA
&&
529 !wfFindFile( $title )
531 $vals['missing'] = '';
533 $pages[$fakeId] = $vals;
536 // Output general page information for found titles
537 foreach ( $pageSet->getGoodTitles() as $pageid => $title ) {
539 $vals['pageid'] = $pageid;
540 ApiQueryBase
::addTitleInfo( $vals, $title );
541 $pages[$pageid] = $vals;
544 if ( count( $pages ) ) {
545 if ( $this->mParams
['indexpageids'] ) {
546 $pageIDs = array_keys( $pages );
547 // json treats all map keys as strings - converting to match
548 $pageIDs = array_map( 'strval', $pageIDs );
549 $result->setIndexedTagName( $pageIDs, 'id' );
550 $result->addValue( 'query', 'pageids', $pageIDs );
553 $result->setIndexedTagName( $pages, 'page' );
554 $result->addValue( 'query', 'pages', $pages );
556 if ( $this->mParams
['export'] ) {
557 $this->doExport( $pageSet, $result );
562 * This method is called by the generator base when generator in the smart-continue
563 * mode tries to set 'query-continue' value. ApiQuery stores those values separately
564 * until the post-processing when it is known if the generation should continue or repeat.
565 * @param ApiQueryGeneratorBase $module generator module
566 * @param string $paramName
567 * @param mixed $paramValue
568 * @return bool true if processed, false if this is a legacy continue
570 public function setGeneratorContinue( $module, $paramName, $paramValue ) {
571 if ( $this->mUseLegacyContinue
) {
574 $paramName = $module->encodeParamName( $paramName );
575 if ( $this->mGeneratorContinue
=== null ) {
576 $this->mGeneratorContinue
= array();
578 $this->mGeneratorContinue
[$paramName] = $paramValue;
584 * @param $pageSet ApiPageSet Pages to be exported
585 * @param $result ApiResult Result to output to
587 private function doExport( $pageSet, $result ) {
588 $exportTitles = array();
589 $titles = $pageSet->getGoodTitles();
590 if ( count( $titles ) ) {
591 $user = $this->getUser();
592 /** @var $title Title */
593 foreach ( $titles as $title ) {
594 if ( $title->userCan( 'read', $user ) ) {
595 $exportTitles[] = $title;
600 $exporter = new WikiExporter( $this->getDB() );
601 // WikiExporter writes to stdout, so catch its
604 $exporter->openStream();
605 foreach ( $exportTitles as $title ) {
606 $exporter->pageByTitle( $title );
608 $exporter->closeStream();
609 $exportxml = ob_get_contents();
612 // Don't check the size of exported stuff
613 // It's not continuable, so it would cause more
614 // problems than it'd solve
615 $result->disableSizeCheck();
616 if ( $this->mParams
['exportnowrap'] ) {
618 // Raw formatter will handle this
619 $result->addValue( null, 'text', $exportxml );
620 $result->addValue( null, 'mime', 'text/xml' );
623 ApiResult
::setContent( $r, $exportxml );
624 $result->addValue( 'query', 'export', $r );
626 $result->enableSizeCheck();
629 public function getAllowedParams( $flags = 0 ) {
632 ApiBase
::PARAM_ISMULTI
=> true,
633 ApiBase
::PARAM_TYPE
=> $this->mModuleMgr
->getNames( 'prop' )
636 ApiBase
::PARAM_ISMULTI
=> true,
637 ApiBase
::PARAM_TYPE
=> $this->mModuleMgr
->getNames( 'list' )
640 ApiBase
::PARAM_ISMULTI
=> true,
641 ApiBase
::PARAM_TYPE
=> $this->mModuleMgr
->getNames( 'meta' )
643 'indexpageids' => false,
645 'exportnowrap' => false,
650 $result +
= $this->getPageSet()->getFinalParams( $flags );
657 * Override the parent to generate help messages for all available query modules.
660 public function makeHelpMsg() {
662 // Use parent to make default message for the query module
663 $msg = parent
::makeHelpMsg();
665 $querySeparator = str_repeat( '--- ', 12 );
666 $moduleSeparator = str_repeat( '*** ', 14 );
667 $msg .= "\n$querySeparator Query: Prop $querySeparator\n\n";
668 $msg .= $this->makeHelpMsgHelper( 'prop' );
669 $msg .= "\n$querySeparator Query: List $querySeparator\n\n";
670 $msg .= $this->makeHelpMsgHelper( 'list' );
671 $msg .= "\n$querySeparator Query: Meta $querySeparator\n\n";
672 $msg .= $this->makeHelpMsgHelper( 'meta' );
673 $msg .= "\n\n$moduleSeparator Modules: continuation $moduleSeparator\n\n";
679 * For all modules of a given group, generate help messages and join them together
680 * @param string $group Module group
683 private function makeHelpMsgHelper( $group ) {
684 $moduleDescriptions = array();
686 $moduleNames = $this->mModuleMgr
->getNames( $group );
687 sort( $moduleNames );
688 foreach ( $moduleNames as $name ) {
690 * @var $module ApiQueryBase
692 $module = $this->mModuleMgr
->getModule( $name );
694 $msg = ApiMain
::makeHelpMsgHeader( $module, $group );
695 $msg2 = $module->makeHelpMsg();
696 if ( $msg2 !== false ) {
699 if ( $module instanceof ApiQueryGeneratorBase
) {
700 $msg .= "Generator:\n This module may be used as a generator\n";
702 $moduleDescriptions[] = $msg;
705 return implode( "\n", $moduleDescriptions );
708 public function shouldCheckMaxlag() {
712 public function getParamDescription() {
713 return $this->getPageSet()->getFinalParamDescription() +
array(
714 'prop' => 'Which properties to get for the titles/revisions/pageids. ' .
715 'Module help is available below',
716 'list' => 'Which lists to get. Module help is available below',
717 'meta' => 'Which metadata to get about the site. Module help is available below',
718 'indexpageids' => 'Include an additional pageids section listing all returned page IDs',
719 'export' => 'Export the current revisions of all given or generated pages',
720 'exportnowrap' => 'Return the export XML without wrapping it in an ' .
721 'XML result (same format as Special:Export). Can only be used with export',
722 'iwurl' => 'Whether to get the full URL if the title is an interwiki link',
724 'When present, formats query-continue as key-value pairs that ' .
725 'should simply be merged into the original request.',
726 'This parameter must be set to an empty string in the initial query.',
727 'This parameter is recommended for all new development, and ' .
728 'will be made default in the next API version.'
733 public function getDescription() {
735 'Query API module allows applications to get needed pieces of data ' .
736 'from the MediaWiki databases,',
737 'and is loosely based on the old query.php interface.',
738 'All data modifications will first have to use query to acquire a ' .
739 'token to prevent abuse from malicious sites'
743 public function getPossibleErrors() {
745 parent
::getPossibleErrors(),
746 $this->getPageSet()->getFinalPossibleErrors()
750 public function getExamples() {
752 'api.php?action=query&prop=revisions&meta=siteinfo&' .
753 'titles=Main%20Page&rvprop=user|comment&continue=',
754 'api.php?action=query&generator=allpages&gapprefix=API/&prop=revisions&continue=',
758 public function getHelpUrls() {
760 'https://www.mediawiki.org/wiki/API:Query',
761 'https://www.mediawiki.org/wiki/API:Meta',
762 'https://www.mediawiki.org/wiki/API:Properties',
763 'https://www.mediawiki.org/wiki/API:Lists',