MediaWiki  1.23.14
ApiQuery.php
Go to the documentation of this file.
1 <?php
38 class ApiQuery extends ApiBase {
39 
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',
61  );
62 
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  'prefixsearch' => 'ApiQueryPrefixSearch',
90  'protectedtitles' => 'ApiQueryProtectedTitles',
91  'querypage' => 'ApiQueryQueryPage',
92  'random' => 'ApiQueryRandom',
93  'recentchanges' => 'ApiQueryRecentChanges',
94  'search' => 'ApiQuerySearch',
95  'tags' => 'ApiQueryTags',
96  'usercontribs' => 'ApiQueryContributions',
97  'users' => 'ApiQueryUsers',
98  'watchlist' => 'ApiQueryWatchlist',
99  'watchlistraw' => 'ApiQueryWatchlistRaw',
100  );
101 
106  private static $QueryMetaModules = array(
107  'allmessages' => 'ApiQueryAllMessages',
108  'siteinfo' => 'ApiQuerySiteinfo',
109  'userinfo' => 'ApiQueryUserInfo',
110  'filerepoinfo' => 'ApiQueryFileRepoInfo',
111  );
112 
116  private $mPageSet;
117 
118  private $mParams;
119  private $mNamedDB = array();
120  private $mModuleMgr;
122  private $mUseLegacyContinue;
123 
128  public function __construct( $main, $action ) {
129  parent::__construct( $main, $action );
130 
131  $this->mModuleMgr = new ApiModuleManager( $this );
132 
133  // Allow custom modules to be added in LocalSettings.php
134  global $wgAPIPropModules, $wgAPIListModules, $wgAPIMetaModules;
135  $this->mModuleMgr->addModules( self::$QueryPropModules, 'prop' );
136  $this->mModuleMgr->addModules( $wgAPIPropModules, 'prop' );
137  $this->mModuleMgr->addModules( self::$QueryListModules, 'list' );
138  $this->mModuleMgr->addModules( $wgAPIListModules, 'list' );
139  $this->mModuleMgr->addModules( self::$QueryMetaModules, 'meta' );
140  $this->mModuleMgr->addModules( $wgAPIMetaModules, 'meta' );
141 
142  // Create PageSet that will process titles/pageids/revids/generator
143  $this->mPageSet = new ApiPageSet( $this );
144  }
145 
150  public function getModuleManager() {
151  return $this->mModuleMgr;
152  }
153 
164  public function getNamedDB( $name, $db, $groups ) {
165  if ( !array_key_exists( $name, $this->mNamedDB ) ) {
166  $this->profileDBIn();
167  $this->mNamedDB[$name] = wfGetDB( $db, $groups );
168  $this->profileDBOut();
169  }
170 
171  return $this->mNamedDB[$name];
172  }
173 
178  public function getPageSet() {
179  return $this->mPageSet;
180  }
181 
187  public function getModules() {
188  wfDeprecated( __METHOD__, '1.21' );
189 
190  return $this->getModuleManager()->getNamesWithClasses();
191  }
192 
198  public function getGenerators() {
199  wfDeprecated( __METHOD__, '1.21' );
200  $gens = array();
201  foreach ( $this->mModuleMgr->getNamesWithClasses() as $name => $class ) {
202  if ( is_subclass_of( $class, 'ApiQueryGeneratorBase' ) ) {
203  $gens[$name] = $class;
204  }
205  }
206 
207  return $gens;
208  }
209 
216  function getModuleType( $moduleName ) {
217  return $this->getModuleManager()->getModuleGroup( $moduleName );
218  }
219 
223  public function getCustomPrinter() {
224  // If &exportnowrap is set, use the raw formatter
225  if ( $this->getParameter( 'export' ) &&
226  $this->getParameter( 'exportnowrap' )
227  ) {
228  return new ApiFormatRaw( $this->getMain(),
229  $this->getMain()->createPrinterByName( 'xml' ) );
230  } else {
231  return null;
232  }
233  }
234 
245  public function execute() {
246  $this->mParams = $this->extractRequestParams();
247 
248  // $pagesetParams is a array of parameter names used by the pageset generator
249  // or null if pageset has already finished and is no longer needed
250  // $completeModules is a set of complete modules with the name as key
251  $this->initContinue( $pagesetParams, $completeModules );
252 
253  // Instantiate requested modules
254  $allModules = array();
255  $this->instantiateModules( $allModules, 'prop' );
256  $propModules = $allModules; // Keep a copy
257  $this->instantiateModules( $allModules, 'list' );
258  $this->instantiateModules( $allModules, 'meta' );
259 
260  // Filter modules based on continue parameter
261  $modules = $this->initModules( $allModules, $completeModules, $pagesetParams !== null );
262 
263  // Execute pageset if in legacy mode or if pageset is not done
264  if ( $completeModules === null || $pagesetParams !== null ) {
265  // Populate page/revision information
266  $this->mPageSet->execute();
267  // Record page information (title, namespace, if exists, etc)
268  $this->outputGeneralPageInfo();
269  } else {
270  $this->mPageSet->executeDryRun();
271  }
272 
273  $cacheMode = $this->mPageSet->getCacheMode();
274 
275  // Execute all unfinished modules
277  foreach ( $modules as $module ) {
278  $params = $module->extractRequestParams();
279  $cacheMode = $this->mergeCacheMode(
280  $cacheMode, $module->getCacheMode( $params ) );
281  $module->profileIn();
282  $module->execute();
283  wfRunHooks( 'APIQueryAfterExecute', array( &$module ) );
284  $module->profileOut();
285  }
286 
287  // Set the cache mode
288  $this->getMain()->setCacheMode( $cacheMode );
289 
290  if ( $completeModules === null ) {
291  return; // Legacy continue, we are done
292  }
293 
294  // Reformat query-continue result section
295  $result = $this->getResult();
296  $qc = $result->getData();
297  if ( isset( $qc['query-continue'] ) ) {
298  $qc = $qc['query-continue'];
299  $result->unsetValue( null, 'query-continue' );
300  } elseif ( $this->mGeneratorContinue !== null ) {
301  $qc = array();
302  } else {
303  // no more "continue"s, we are done!
304  return;
305  }
306 
307  // we are done with all the modules that do not have result in query-continue
308  $completeModules = array_merge( $completeModules, array_diff_key( $modules, $qc ) );
309  if ( $pagesetParams !== null ) {
310  // The pageset is still in use, check if all props have finished
311  $incompleteProps = array_intersect_key( $propModules, $qc );
312  if ( count( $incompleteProps ) > 0 ) {
313  // Properties are not done, continue with the same pageset state - copy current parameters
314  $main = $this->getMain();
315  $contValues = array();
316  foreach ( $pagesetParams as $param ) {
317  // The param name is already prefix-encoded
318  $contValues[$param] = $main->getVal( $param );
319  }
320  } elseif ( $this->mGeneratorContinue !== null ) {
321  // Move to the next set of pages produced by pageset, properties need to be restarted
322  $contValues = $this->mGeneratorContinue;
323  $pagesetParams = array_keys( $contValues );
324  $completeModules = array_diff_key( $completeModules, $propModules );
325  } else {
326  // Done with the pageset, finish up with the the lists and meta modules
327  $pagesetParams = null;
328  }
329  }
330 
331  $continue = '||' . implode( '|', array_keys( $completeModules ) );
332  if ( $pagesetParams !== null ) {
333  // list of all pageset parameters to use in the next request
334  $continue = implode( '|', $pagesetParams ) . $continue;
335  } else {
336  // we are done with the pageset
337  $contValues = array();
338  $continue = '-' . $continue;
339  }
340  $contValues['continue'] = $continue;
341  foreach ( $qc as $qcModule ) {
342  foreach ( $qcModule as $qcKey => $qcValue ) {
343  $contValues[$qcKey] = $qcValue;
344  }
345  }
346  $this->getResult()->addValue( null, 'continue', $contValues );
347  }
348 
354  private function initContinue( &$pagesetParams, &$completeModules ) {
355  $pagesetParams = array();
356  $continue = $this->mParams['continue'];
357  if ( $continue !== null ) {
358  $this->mUseLegacyContinue = false;
359  if ( $continue !== '' ) {
360  // Format: ' pagesetParam1 | pagesetParam2 || module1 | module2 | module3 | ...
361  // If pageset is done, use '-'
362  $continue = explode( '||', $continue );
363  $this->dieContinueUsageIf( count( $continue ) !== 2 );
364  if ( $continue[0] === '-' ) {
365  $pagesetParams = null; // No need to execute pageset
366  } elseif ( $continue[0] !== '' ) {
367  // list of pageset params that might need to be repeated
368  $pagesetParams = explode( '|', $continue[0] );
369  }
370  $continue = $continue[1];
371  }
372  if ( $continue !== '' ) {
373  $completeModules = array_flip( explode( '|', $continue ) );
374  } else {
375  $completeModules = array();
376  }
377  } else {
378  $this->mUseLegacyContinue = true;
379  $completeModules = null;
380  }
381  }
382 
390  private function initModules( $allModules, $completeModules, $usePageset ) {
391  $modules = $allModules;
392  $tmp = $completeModules;
393  $wasPosted = $this->getRequest()->wasPosted();
394 
396  foreach ( $allModules as $moduleName => $module ) {
397  if ( !$wasPosted && $module->mustBePosted() ) {
398  $this->dieUsageMsgOrDebug( array( 'mustbeposted', $moduleName ) );
399  }
400  if ( $completeModules !== null && array_key_exists( $moduleName, $completeModules ) ) {
401  // If this module is done, mark all its params as used
402  $module->extractRequestParams();
403  // Make sure this module is not used during execution
404  unset( $modules[$moduleName] );
405  unset( $tmp[$moduleName] );
406  } elseif ( $completeModules === null || $usePageset ) {
407  // Query modules may optimize data requests through the $this->getPageSet()
408  // object by adding extra fields from the page table.
409  // This function will gather all the extra request fields from the modules.
410  $module->requestExtraData( $this->mPageSet );
411  } else {
412  // Error - this prop module must have finished before generator is done
413  $this->dieContinueUsageIf( $this->mModuleMgr->getModuleGroup( $moduleName ) === 'prop' );
414  }
415  }
416  $this->dieContinueUsageIf( $completeModules !== null && count( $tmp ) !== 0 );
417 
418  return $modules;
419  }
420 
430  protected function mergeCacheMode( $cacheMode, $modCacheMode ) {
431  if ( $modCacheMode === 'anon-public-user-private' ) {
432  if ( $cacheMode !== 'private' ) {
433  $cacheMode = 'anon-public-user-private';
434  }
435  } elseif ( $modCacheMode === 'public' ) {
436  // do nothing, if it's public already it will stay public
437  } else { // private
438  $cacheMode = 'private';
439  }
440 
441  return $cacheMode;
442  }
443 
449  private function instantiateModules( &$modules, $param ) {
450  if ( isset( $this->mParams[$param] ) ) {
451  foreach ( $this->mParams[$param] as $moduleName ) {
452  $instance = $this->mModuleMgr->getModule( $moduleName, $param );
453  if ( $instance === null ) {
454  ApiBase::dieDebug( __METHOD__, 'Error instantiating module' );
455  }
456  // Ignore duplicates. TODO 2.0: die()?
457  if ( !array_key_exists( $moduleName, $modules ) ) {
458  $modules[$moduleName] = $instance;
459  }
460  }
461  }
462  }
463 
469  private function outputGeneralPageInfo() {
470  $pageSet = $this->getPageSet();
471  $result = $this->getResult();
472 
473  // We don't check for a full result set here because we can't be adding
474  // more than 380K. The maximum revision size is in the megabyte range,
475  // and the maximum result size must be even higher than that.
476 
477  $values = $pageSet->getNormalizedTitlesAsResult( $result );
478  if ( $values ) {
479  $result->addValue( 'query', 'normalized', $values );
480  }
481  $values = $pageSet->getConvertedTitlesAsResult( $result );
482  if ( $values ) {
483  $result->addValue( 'query', 'converted', $values );
484  }
485  $values = $pageSet->getInterwikiTitlesAsResult( $result, $this->mParams['iwurl'] );
486  if ( $values ) {
487  $result->addValue( 'query', 'interwiki', $values );
488  }
489  $values = $pageSet->getRedirectTitlesAsResult( $result );
490  if ( $values ) {
491  $result->addValue( 'query', 'redirects', $values );
492  }
493  $values = $pageSet->getMissingRevisionIDsAsResult( $result );
494  if ( $values ) {
495  $result->addValue( 'query', 'badrevids', $values );
496  }
497 
498  // Page elements
499  $pages = array();
500 
501  // Report any missing titles
502  foreach ( $pageSet->getMissingTitles() as $fakeId => $title ) {
503  $vals = array();
505  $vals['missing'] = '';
506  $pages[$fakeId] = $vals;
507  }
508  // Report any invalid titles
509  foreach ( $pageSet->getInvalidTitles() as $fakeId => $title ) {
510  $pages[$fakeId] = array( 'title' => $title, 'invalid' => '' );
511  }
512  // Report any missing page ids
513  foreach ( $pageSet->getMissingPageIDs() as $pageid ) {
514  $pages[$pageid] = array(
515  'pageid' => $pageid,
516  'missing' => ''
517  );
518  }
519  // Report special pages
521  foreach ( $pageSet->getSpecialTitles() as $fakeId => $title ) {
522  $vals = array();
524  $vals['special'] = '';
525  if ( $title->isSpecialPage() &&
526  !SpecialPageFactory::exists( $title->getDBkey() )
527  ) {
528  $vals['missing'] = '';
529  } elseif ( $title->getNamespace() == NS_MEDIA &&
530  !wfFindFile( $title )
531  ) {
532  $vals['missing'] = '';
533  }
534  $pages[$fakeId] = $vals;
535  }
536 
537  // Output general page information for found titles
538  foreach ( $pageSet->getGoodTitles() as $pageid => $title ) {
539  $vals = array();
540  $vals['pageid'] = $pageid;
542  $pages[$pageid] = $vals;
543  }
544 
545  if ( count( $pages ) ) {
546  if ( $this->mParams['indexpageids'] ) {
547  $pageIDs = array_keys( $pages );
548  // json treats all map keys as strings - converting to match
549  $pageIDs = array_map( 'strval', $pageIDs );
550  $result->setIndexedTagName( $pageIDs, 'id' );
551  $result->addValue( 'query', 'pageids', $pageIDs );
552  }
553 
554  $result->setIndexedTagName( $pages, 'page' );
555  $result->addValue( 'query', 'pages', $pages );
556  }
557  if ( $this->mParams['export'] ) {
558  $this->doExport( $pageSet, $result );
559  }
560  }
561 
571  public function setGeneratorContinue( $module, $paramName, $paramValue ) {
572  if ( $this->mUseLegacyContinue ) {
573  return false;
574  }
575  $paramName = $module->encodeParamName( $paramName );
576  if ( $this->mGeneratorContinue === null ) {
577  $this->mGeneratorContinue = array();
578  }
579  $this->mGeneratorContinue[$paramName] = $paramValue;
580 
581  return true;
582  }
583 
588  private function doExport( $pageSet, $result ) {
589  $exportTitles = array();
590  $titles = $pageSet->getGoodTitles();
591  if ( count( $titles ) ) {
592  $user = $this->getUser();
594  foreach ( $titles as $title ) {
595  if ( $title->userCan( 'read', $user ) ) {
596  $exportTitles[] = $title;
597  }
598  }
599  }
600 
601  $exporter = new WikiExporter( $this->getDB() );
602  // WikiExporter writes to stdout, so catch its
603  // output with an ob
604  ob_start();
605  $exporter->openStream();
606  foreach ( $exportTitles as $title ) {
607  $exporter->pageByTitle( $title );
608  }
609  $exporter->closeStream();
610  $exportxml = ob_get_contents();
611  ob_end_clean();
612 
613  // Don't check the size of exported stuff
614  // It's not continuable, so it would cause more
615  // problems than it'd solve
616  $result->disableSizeCheck();
617  if ( $this->mParams['exportnowrap'] ) {
618  $result->reset();
619  // Raw formatter will handle this
620  $result->addValue( null, 'text', $exportxml );
621  $result->addValue( null, 'mime', 'text/xml' );
622  } else {
623  $r = array();
624  ApiResult::setContent( $r, $exportxml );
625  $result->addValue( 'query', 'export', $r );
626  }
627  $result->enableSizeCheck();
628  }
629 
630  public function getAllowedParams( $flags = 0 ) {
631  $result = array(
632  'prop' => array(
633  ApiBase::PARAM_ISMULTI => true,
634  ApiBase::PARAM_TYPE => $this->mModuleMgr->getNames( 'prop' )
635  ),
636  'list' => array(
637  ApiBase::PARAM_ISMULTI => true,
638  ApiBase::PARAM_TYPE => $this->mModuleMgr->getNames( 'list' )
639  ),
640  'meta' => array(
641  ApiBase::PARAM_ISMULTI => true,
642  ApiBase::PARAM_TYPE => $this->mModuleMgr->getNames( 'meta' )
643  ),
644  'indexpageids' => false,
645  'export' => false,
646  'exportnowrap' => false,
647  'iwurl' => false,
648  'continue' => null,
649  );
650  if ( $flags ) {
651  $result += $this->getPageSet()->getFinalParams( $flags );
652  }
653 
654  return $result;
655  }
656 
661  public function makeHelpMsg() {
662 
663  // Use parent to make default message for the query module
664  $msg = parent::makeHelpMsg();
665 
666  $querySeparator = str_repeat( '--- ', 12 );
667  $moduleSeparator = str_repeat( '*** ', 14 );
668  $msg .= "\n$querySeparator Query: Prop $querySeparator\n\n";
669  $msg .= $this->makeHelpMsgHelper( 'prop' );
670  $msg .= "\n$querySeparator Query: List $querySeparator\n\n";
671  $msg .= $this->makeHelpMsgHelper( 'list' );
672  $msg .= "\n$querySeparator Query: Meta $querySeparator\n\n";
673  $msg .= $this->makeHelpMsgHelper( 'meta' );
674  $msg .= "\n\n$moduleSeparator Modules: continuation $moduleSeparator\n\n";
675 
676  return $msg;
677  }
678 
684  private function makeHelpMsgHelper( $group ) {
685  $moduleDescriptions = array();
686 
687  $moduleNames = $this->mModuleMgr->getNames( $group );
688  sort( $moduleNames );
689  foreach ( $moduleNames as $name ) {
693  $module = $this->mModuleMgr->getModule( $name );
694 
695  $msg = ApiMain::makeHelpMsgHeader( $module, $group );
696  $msg2 = $module->makeHelpMsg();
697  if ( $msg2 !== false ) {
698  $msg .= $msg2;
699  }
700  if ( $module instanceof ApiQueryGeneratorBase ) {
701  $msg .= "Generator:\n This module may be used as a generator\n";
702  }
703  $moduleDescriptions[] = $msg;
704  }
705 
706  return implode( "\n", $moduleDescriptions );
707  }
708 
709  public function shouldCheckMaxlag() {
710  return true;
711  }
712 
713  public function getParamDescription() {
714  return $this->getPageSet()->getFinalParamDescription() + array(
715  'prop' => 'Which properties to get for the titles/revisions/pageids. ' .
716  'Module help is available below',
717  'list' => 'Which lists to get. Module help is available below',
718  'meta' => 'Which metadata to get about the site. Module help is available below',
719  'indexpageids' => 'Include an additional pageids section listing all returned page IDs',
720  'export' => 'Export the current revisions of all given or generated pages',
721  'exportnowrap' => 'Return the export XML without wrapping it in an ' .
722  'XML result (same format as Special:Export). Can only be used with export',
723  'iwurl' => 'Whether to get the full URL if the title is an interwiki link',
724  'continue' => array(
725  'When present, formats query-continue as key-value pairs that ' .
726  'should simply be merged into the original request.',
727  'This parameter must be set to an empty string in the initial query.',
728  'This parameter is recommended for all new development, and ' .
729  'will be made default in the next API version.'
730  ),
731  );
732  }
733 
734  public function getDescription() {
735  return array(
736  'Query API module allows applications to get needed pieces of data ' .
737  'from the MediaWiki databases,',
738  'and is loosely based on the old query.php interface.',
739  'All data modifications will first have to use query to acquire a ' .
740  'token to prevent abuse from malicious sites.'
741  );
742  }
743 
744  public function getPossibleErrors() {
745  return array_merge(
746  parent::getPossibleErrors(),
748  );
749  }
750 
751  public function getExamples() {
752  return array(
753  'api.php?action=query&prop=revisions&meta=siteinfo&' .
754  'titles=Main%20Page&rvprop=user|comment&continue=',
755  'api.php?action=query&generator=allpages&gapprefix=API/&prop=revisions&continue=',
756  );
757  }
758 
759  public function getHelpUrls() {
760  return array(
761  'https://www.mediawiki.org/wiki/API:Query',
762  'https://www.mediawiki.org/wiki/API:Meta',
763  'https://www.mediawiki.org/wiki/API:Properties',
764  'https://www.mediawiki.org/wiki/API:Lists',
765  );
766  }
767 }
ApiBase\dieUsageMsgOrDebug
dieUsageMsgOrDebug( $error)
Will only set a warning instead of failing if the global $wgDebugAPI is set to true.
Definition: ApiBase.php:1969
ApiQuery\$mParams
$mParams
Definition: ApiQuery.php:117
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1528
ApiQuery\setGeneratorContinue
setGeneratorContinue( $module, $paramName, $paramValue)
This method is called by the generator base when generator in the smart-continue mode tries to set 'q...
Definition: ApiQuery.php:570
ApiQuery\initContinue
initContinue(&$pagesetParams, &$completeModules)
Parse 'continue' parameter into the list of complete modules and a list of generator parameters.
Definition: ApiQuery.php:353
ApiQuery
This is the main query class.
Definition: ApiQuery.php:38
ApiQuery\getModules
getModules()
Get the array mapping module names to class names.
Definition: ApiQuery.php:186
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ApiQuery\getPageSet
getPageSet()
Gets the set of pages the user has requested (or generated)
Definition: ApiQuery.php:177
ApiResult\setContent
static setContent(&$arr, $value, $subElemName=null)
Adds a content element to an array.
Definition: ApiResult.php:201
ApiQuery\getGenerators
getGenerators()
Get the generators array mapping module names to class names.
Definition: ApiQuery.php:197
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3714
ApiQuery\$QueryMetaModules
static $QueryMetaModules
Definition: ApiQuery.php:106
ApiBase\profileDBIn
profileDBIn()
Start module profiling.
Definition: ApiBase.php:2286
ApiBase\PARAM_TYPE
const PARAM_TYPE
Definition: ApiBase.php:50
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:205
ApiBase\profileDBOut
profileDBOut()
End database profiling.
Definition: ApiBase.php:2303
ApiQuery\getPossibleErrors
getPossibleErrors()
Returns a list of all possible errors returned by the module.
Definition: ApiQuery.php:743
$params
$params
Definition: styleTest.css.php:40
ApiBase\getDB
getDB()
Gets a default slave database connection object.
Definition: ApiBase.php:2336
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:77
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2124
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
ApiQuery\$mUseLegacyContinue
$mUseLegacyContinue
Definition: ApiQuery.php:121
ApiQuery\getHelpUrls
getHelpUrls()
Definition: ApiQuery.php:758
ApiPageSet
This class contains a list of pages that the client has requested.
Definition: ApiPageSet.php:41
ApiBase
This abstract class implements many basic API functions, and is the base of all API classes.
Definition: ApiBase.php:42
ApiQuery\$QueryListModules
static $QueryListModules
Definition: ApiQuery.php:67
ApiQuery\getDescription
getDescription()
Returns the description string for this module.
Definition: ApiQuery.php:733
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1174
$titles
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
Definition: linkcache.txt:17
ApiBase\getFinalPossibleErrors
getFinalPossibleErrors()
Get final list of possible errors, after hooks have had a chance to tweak it as needed.
Definition: ApiBase.php:2191
ApiQuery\getParamDescription
getParamDescription()
Returns an array of parameter descriptions.
Definition: ApiQuery.php:712
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4066
ApiFormatRaw
Formatter that spits out anything you like with any desired MIME type.
Definition: ApiFormatRaw.php:31
ApiQuery\getNamedDB
getNamedDB( $name, $db, $groups)
Get the query database connection with the given name.
Definition: ApiQuery.php:163
ApiQuery\makeHelpMsgHelper
makeHelpMsgHelper( $group)
For all modules of a given group, generate help messages and join them together.
Definition: ApiQuery.php:683
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
SpecialPageFactory\exists
static exists( $name)
Check if a given name exist as a special page or as a special page alias.
Definition: SpecialPageFactory.php:326
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
WikiExporter
Definition: Export.php:33
ApiModuleManager
This class holds a list of modules and handles instantiation.
Definition: ApiModuleManager.php:34
ApiBase\extractRequestParams
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:707
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:67
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the $prefix.
Definition: ApiBase.php:1989
ApiQuery\$QueryPropModules
static $QueryPropModules
Definition: ApiQuery.php:44
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
ApiQuery\doExport
doExport( $pageSet, $result)
Definition: ApiQuery.php:587
ApiMain\makeHelpMsgHeader
static makeHelpMsgHeader( $module, $paramName)
Definition: ApiMain.php:1345
ApiQueryGeneratorBase
Definition: ApiQueryBase.php:626
ApiQuery\getModuleManager
getModuleManager()
Overrides to return this instance's module manager.
Definition: ApiQuery.php:149
ApiQuery\getCustomPrinter
getCustomPrinter()
Definition: ApiQuery.php:222
ApiQuery\mergeCacheMode
mergeCacheMode( $cacheMode, $modCacheMode)
Update a cache mode string, applying the cache mode of a new module to it.
Definition: ApiQuery.php:429
ApiQuery\$mPageSet
ApiPageSet $mPageSet
Definition: ApiQuery.php:115
ApiQuery\makeHelpMsg
makeHelpMsg()
Override the parent to generate help messages for all available query modules.
Definition: ApiQuery.php:660
ApiQuery\outputGeneralPageInfo
outputGeneralPageInfo()
Appends an element for each page in the current pageSet with the most general information (id,...
Definition: ApiQuery.php:468
ApiQuery\getAllowedParams
getAllowedParams( $flags=0)
Definition: ApiQuery.php:629
ApiBase\getParameter
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
Definition: ApiBase.php:731
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
wfFindFile
wfFindFile( $title, $options=array())
Find a file.
Definition: GlobalFunctions.php:3757
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
Definition: ApiBase.php:48
ApiQuery\$mModuleMgr
$mModuleMgr
Definition: ApiQuery.php:119
ApiQuery\$mGeneratorContinue
$mGeneratorContinue
Definition: ApiQuery.php:120
ApiBase\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiBase.php:585
ApiQuery\__construct
__construct( $main, $action)
Definition: ApiQuery.php:127
ApiBase\getMain
getMain()
Get the main module.
Definition: ApiBase.php:188
ApiQuery\getExamples
getExamples()
Returns usage examples for this module.
Definition: ApiQuery.php:750
ApiQuery\getModuleType
getModuleType( $moduleName)
Get whether the specified module is a prop, list or a meta query module.
Definition: ApiQuery.php:215
ApiQuery\execute
execute()
Query execution happens in the following steps: #1 Create a PageSet object with any pages requested b...
Definition: ApiQuery.php:244
ApiBase\dieDebug
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
Definition: ApiBase.php:2030
ApiQuery\$mNamedDB
$mNamedDB
Definition: ApiQuery.php:118
ApiQuery\shouldCheckMaxlag
shouldCheckMaxlag()
Indicates if this module needs maxlag to be checked.
Definition: ApiQuery.php:708
ApiQuery\initModules
initModules( $allModules, $completeModules, $usePageset)
Validate sub-modules, filter out completed ones, and do requestExtraData()
Definition: ApiQuery.php:389
ApiQuery\instantiateModules
instantiateModules(&$modules, $param)
Create instances of all modules requested by the client.
Definition: ApiQuery.php:448
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:339