MediaWiki  1.23.15
ApiQueryBacklinks.php
Go to the documentation of this file.
1 <?php
36 
40  private $rootTitle;
41 
44 
50  private $pageMap = array();
51  private $resultArr;
52 
53  private $redirTitles = array();
54  private $continueStr = null;
55 
56  // output element name, database column field prefix, database table
57  private $backlinksSettings = array(
58  'backlinks' => array(
59  'code' => 'bl',
60  'prefix' => 'pl',
61  'linktbl' => 'pagelinks',
62  'helpurl' => 'https://www.mediawiki.org/wiki/API:Backlinks',
63  ),
64  'embeddedin' => array(
65  'code' => 'ei',
66  'prefix' => 'tl',
67  'linktbl' => 'templatelinks',
68  'helpurl' => 'https://www.mediawiki.org/wiki/API:Embeddedin',
69  ),
70  'imageusage' => array(
71  'code' => 'iu',
72  'prefix' => 'il',
73  'linktbl' => 'imagelinks',
74  'helpurl' => 'https://www.mediawiki.org/wiki/API:Imageusage',
75  )
76  );
77 
78  public function __construct( $query, $moduleName ) {
79  $settings = $this->backlinksSettings[$moduleName];
80  $prefix = $settings['prefix'];
81  $code = $settings['code'];
82  $this->resultArr = array();
83 
84  parent::__construct( $query, $moduleName, $code );
85  $this->bl_ns = $prefix . '_namespace';
86  $this->bl_from = $prefix . '_from';
87  $this->bl_table = $settings['linktbl'];
88  $this->bl_code = $code;
89  $this->helpUrl = $settings['helpurl'];
90 
91  $this->hasNS = $moduleName !== 'imageusage';
92  if ( $this->hasNS ) {
93  $this->bl_title = $prefix . '_title';
94  $this->bl_fields = array(
95  $this->bl_ns,
96  $this->bl_title
97  );
98  } else {
99  $this->bl_title = $prefix . '_to';
100  $this->bl_fields = array(
101  $this->bl_title
102  );
103  }
104  }
105 
106  public function execute() {
107  $this->run();
108  }
109 
110  public function getCacheMode( $params ) {
111  return 'public';
112  }
113 
114  public function executeGenerator( $resultPageSet ) {
115  $this->run( $resultPageSet );
116  }
117 
122  private function prepareFirstQuery( $resultPageSet = null ) {
123  /* SELECT page_id, page_title, page_namespace, page_is_redirect
124  * FROM pagelinks, page WHERE pl_from=page_id
125  * AND pl_title='Foo' AND pl_namespace=0
126  * LIMIT 11 ORDER BY pl_from
127  */
128  $this->addTables( array( $this->bl_table, 'page' ) );
129  $this->addWhere( "{$this->bl_from}=page_id" );
130  if ( is_null( $resultPageSet ) ) {
131  $this->addFields( array( 'page_id', 'page_title', 'page_namespace' ) );
132  } else {
133  $this->addFields( $resultPageSet->getPageTableFields() );
134  }
135 
136  $this->addFields( 'page_is_redirect' );
137  $this->addWhereFld( $this->bl_title, $this->rootTitle->getDBkey() );
138 
139  if ( $this->hasNS ) {
140  $this->addWhereFld( $this->bl_ns, $this->rootTitle->getNamespace() );
141  }
142  $this->addWhereFld( 'page_namespace', $this->params['namespace'] );
143 
144  if ( !is_null( $this->contID ) ) {
145  $op = $this->params['dir'] == 'descending' ? '<' : '>';
146  $this->addWhere( "{$this->bl_from}$op={$this->contID}" );
147  }
148 
149  if ( $this->params['filterredir'] == 'redirects' ) {
150  $this->addWhereFld( 'page_is_redirect', 1 );
151  } elseif ( $this->params['filterredir'] == 'nonredirects' && !$this->redirect ) {
152  // bug 22245 - Check for !redirect, as filtering nonredirects, when
153  // getting what links to them is contradictory
154  $this->addWhereFld( 'page_is_redirect', 0 );
155  }
156 
157  $this->addOption( 'LIMIT', $this->params['limit'] + 1 );
158  $sort = ( $this->params['dir'] == 'descending' ? ' DESC' : '' );
159  $this->addOption( 'ORDER BY', $this->bl_from . $sort );
160  $this->addOption( 'STRAIGHT_JOIN' );
161  }
162 
167  private function prepareSecondQuery( $resultPageSet = null ) {
168  /* SELECT page_id, page_title, page_namespace, page_is_redirect, pl_title, pl_namespace
169  FROM pagelinks, page WHERE pl_from=page_id
170  AND (pl_title='Foo' AND pl_namespace=0) OR (pl_title='Bar' AND pl_namespace=1)
171  ORDER BY pl_namespace, pl_title, pl_from LIMIT 11
172  */
173  $db = $this->getDB();
174  $this->addTables( array( 'page', $this->bl_table ) );
175  $this->addWhere( "{$this->bl_from}=page_id" );
176 
177  if ( is_null( $resultPageSet ) ) {
178  $this->addFields( array( 'page_id', 'page_title', 'page_namespace', 'page_is_redirect' ) );
179  } else {
180  $this->addFields( $resultPageSet->getPageTableFields() );
181  }
182 
183  $this->addFields( $this->bl_title );
184  if ( $this->hasNS ) {
185  $this->addFields( $this->bl_ns );
186  }
187 
188  // We can't use LinkBatch here because $this->hasNS may be false
189  $titleWhere = array();
190  $allRedirNs = array();
191  $allRedirDBkey = array();
193  foreach ( $this->redirTitles as $t ) {
194  $redirNs = $t->getNamespace();
195  $redirDBkey = $t->getDBkey();
196  $titleWhere[] = "{$this->bl_title} = " . $db->addQuotes( $redirDBkey ) .
197  ( $this->hasNS ? " AND {$this->bl_ns} = {$redirNs}" : '' );
198  $allRedirNs[] = $redirNs;
199  $allRedirDBkey[] = $redirDBkey;
200  }
201  $this->addWhere( $db->makeList( $titleWhere, LIST_OR ) );
202  $this->addWhereFld( 'page_namespace', $this->params['namespace'] );
203 
204  if ( !is_null( $this->redirID ) ) {
205  $op = $this->params['dir'] == 'descending' ? '<' : '>';
207  $first = $this->redirTitles[0];
208  $title = $db->addQuotes( $first->getDBkey() );
209  $ns = $first->getNamespace();
211  if ( $this->hasNS ) {
212  $this->addWhere( "{$this->bl_ns} $op $ns OR " .
213  "({$this->bl_ns} = $ns AND " .
214  "({$this->bl_title} $op $title OR " .
215  "({$this->bl_title} = $title AND " .
216  "{$this->bl_from} $op= $from)))" );
217  } else {
218  $this->addWhere( "{$this->bl_title} $op $title OR " .
219  "({$this->bl_title} = $title AND " .
220  "{$this->bl_from} $op= $from)" );
221  }
222  }
223  if ( $this->params['filterredir'] == 'redirects' ) {
224  $this->addWhereFld( 'page_is_redirect', 1 );
225  } elseif ( $this->params['filterredir'] == 'nonredirects' ) {
226  $this->addWhereFld( 'page_is_redirect', 0 );
227  }
228 
229  $this->addOption( 'LIMIT', $this->params['limit'] + 1 );
230  $orderBy = array();
231  $sort = ( $this->params['dir'] == 'descending' ? ' DESC' : '' );
232  // Don't order by namespace/title if it's constant in the WHERE clause
233  if ( $this->hasNS && count( array_unique( $allRedirNs ) ) != 1 ) {
234  $orderBy[] = $this->bl_ns . $sort;
235  }
236  if ( count( array_unique( $allRedirDBkey ) ) != 1 ) {
237  $orderBy[] = $this->bl_title . $sort;
238  }
239  $orderBy[] = $this->bl_from . $sort;
240  $this->addOption( 'ORDER BY', $orderBy );
241  $this->addOption( 'USE INDEX', array( 'page' => 'PRIMARY' ) );
242  }
243 
248  private function run( $resultPageSet = null ) {
249  $this->params = $this->extractRequestParams( false );
250  $this->redirect = isset( $this->params['redirect'] ) && $this->params['redirect'];
251  $userMax = ( $this->redirect ? ApiBase::LIMIT_BIG1 / 2 : ApiBase::LIMIT_BIG1 );
252  $botMax = ( $this->redirect ? ApiBase::LIMIT_BIG2 / 2 : ApiBase::LIMIT_BIG2 );
253 
254  $result = $this->getResult();
255 
256  if ( $this->params['limit'] == 'max' ) {
257  $this->params['limit'] = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
258  $result->setParsedLimit( $this->getModuleName(), $this->params['limit'] );
259  } else {
260  $this->params['limit'] = intval( $this->params['limit'] );
261  $this->validateLimit( 'limit', $this->params['limit'], 1, $userMax, $botMax );
262  }
263 
264  $this->processContinue();
265  $this->prepareFirstQuery( $resultPageSet );
266 
267  $res = $this->select( __METHOD__ . '::firstQuery' );
268 
269  $count = 0;
270 
271  foreach ( $res as $row ) {
272  if ( ++$count > $this->params['limit'] ) {
273  // We've reached the one extra which shows that there are
274  // additional pages to be had. Stop here...
275  // Continue string preserved in case the redirect query doesn't pass the limit
276  $this->continueStr = $this->getContinueStr( $row->page_id );
277  break;
278  }
279 
280  if ( is_null( $resultPageSet ) ) {
281  $this->extractRowInfo( $row );
282  } else {
283  $this->pageMap[$row->page_namespace][$row->page_title] = $row->page_id;
284  if ( $row->page_is_redirect ) {
285  $this->redirTitles[] = Title::makeTitle( $row->page_namespace, $row->page_title );
286  }
287 
288  $resultPageSet->processDbRow( $row );
289  }
290  }
291 
292  if ( $this->redirect && count( $this->redirTitles ) ) {
293  $this->resetQueryParams();
294  $this->prepareSecondQuery( $resultPageSet );
295  $res = $this->select( __METHOD__ . '::secondQuery' );
296  $count = 0;
297  foreach ( $res as $row ) {
298  if ( ++$count > $this->params['limit'] ) {
299  // We've reached the one extra which shows that there are
300  // additional pages to be had. Stop here...
301  // We need to keep the parent page of this redir in
302  if ( $this->hasNS ) {
303  $parentID = $this->pageMap[$row->{$this->bl_ns}][$row->{$this->bl_title}];
304  } else {
305  $parentID = $this->pageMap[NS_FILE][$row->{$this->bl_title}];
306  }
307  $this->continueStr = $this->getContinueRedirStr( $parentID, $row->page_id );
308  break;
309  }
310 
311  if ( is_null( $resultPageSet ) ) {
312  $this->extractRedirRowInfo( $row );
313  } else {
314  $resultPageSet->processDbRow( $row );
315  }
316  }
317  }
318  if ( is_null( $resultPageSet ) ) {
319  // Try to add the result data in one go and pray that it fits
320  $fit = $result->addValue( 'query', $this->getModuleName(), array_values( $this->resultArr ) );
321  if ( !$fit ) {
322  // It didn't fit. Add elements one by one until the
323  // result is full.
324  foreach ( $this->resultArr as $pageID => $arr ) {
325  // Add the basic entry without redirlinks first
326  $fit = $result->addValue(
327  array( 'query', $this->getModuleName() ),
328  null, array_diff_key( $arr, array( 'redirlinks' => '' ) ) );
329  if ( !$fit ) {
330  $this->continueStr = $this->getContinueStr( $pageID );
331  break;
332  }
333 
334  $hasRedirs = false;
335  $redirLinks = isset( $arr['redirlinks'] ) ? $arr['redirlinks'] : array();
336  foreach ( (array)$redirLinks as $key => $redir ) {
337  $fit = $result->addValue(
338  array( 'query', $this->getModuleName(), $pageID, 'redirlinks' ),
339  $key, $redir );
340  if ( !$fit ) {
341  $this->continueStr = $this->getContinueRedirStr( $pageID, $redir['pageid'] );
342  break;
343  }
344  $hasRedirs = true;
345  }
346  if ( $hasRedirs ) {
347  $result->setIndexedTagName_internal(
348  array( 'query', $this->getModuleName(), $pageID, 'redirlinks' ),
349  $this->bl_code );
350  }
351  if ( !$fit ) {
352  break;
353  }
354  }
355  }
356 
357  $result->setIndexedTagName_internal(
358  array( 'query', $this->getModuleName() ),
359  $this->bl_code
360  );
361  }
362  if ( !is_null( $this->continueStr ) ) {
363  $this->setContinueEnumParameter( 'continue', $this->continueStr );
364  }
365  }
366 
367  private function extractRowInfo( $row ) {
368  $this->pageMap[$row->page_namespace][$row->page_title] = $row->page_id;
369  $t = Title::makeTitle( $row->page_namespace, $row->page_title );
370  $a = array( 'pageid' => intval( $row->page_id ) );
372  if ( $row->page_is_redirect ) {
373  $a['redirect'] = '';
374  $this->redirTitles[] = $t;
375  }
376  // Put all the results in an array first
377  $this->resultArr[$a['pageid']] = $a;
378  }
379 
380  private function extractRedirRowInfo( $row ) {
381  $a['pageid'] = intval( $row->page_id );
382  ApiQueryBase::addTitleInfo( $a, Title::makeTitle( $row->page_namespace, $row->page_title ) );
383  if ( $row->page_is_redirect ) {
384  $a['redirect'] = '';
385  }
386  $ns = $this->hasNS ? $row->{$this->bl_ns} : NS_FILE;
387  $parentID = $this->pageMap[$ns][$row->{$this->bl_title}];
388  // Put all the results in an array first
389  $this->resultArr[$parentID]['redirlinks'][] = $a;
390  $this->getResult()->setIndexedTagName(
391  $this->resultArr[$parentID]['redirlinks'],
392  $this->bl_code
393  );
394  }
395 
396  protected function processContinue() {
397  if ( !is_null( $this->params['continue'] ) ) {
398  $this->parseContinueParam();
399  } else {
400  $this->rootTitle = $this->getTitleOrPageId( $this->params )->getTitle();
401  }
402 
403  // only image titles are allowed for the root in imageinfo mode
404  if ( !$this->hasNS && $this->rootTitle->getNamespace() !== NS_FILE ) {
405  $this->dieUsage(
406  "The title for {$this->getModuleName()} query must be an image",
407  'bad_image_title'
408  );
409  }
410  }
411 
412  protected function parseContinueParam() {
413  $continueList = explode( '|', $this->params['continue'] );
414  // expected format:
415  // ns | key | id1 [| id2]
416  // ns+key: root title
417  // id1: first-level page ID to continue from
418  // id2: second-level page ID to continue from
419 
420  // null stuff out now so we know what's set and what isn't
421  $this->rootTitle = $this->contID = $this->redirID = null;
422  $rootNs = intval( $continueList[0] );
423  $this->dieContinueUsageIf( $rootNs === 0 && $continueList[0] !== '0' );
424 
425  $this->rootTitle = Title::makeTitleSafe( $rootNs, $continueList[1] );
426  $this->dieContinueUsageIf( !$this->rootTitle );
427 
428  $contID = intval( $continueList[2] );
429  $this->dieContinueUsageIf( $contID === 0 && $continueList[2] !== '0' );
430 
431  $this->contID = $contID;
432  $id2 = isset( $continueList[3] ) ? $continueList[3] : null;
433  $redirID = intval( $id2 );
434 
435  if ( $redirID === 0 && $id2 !== '0' ) {
436  // This one isn't required
437  return;
438  }
439  $this->redirID = $redirID;
440  }
441 
442  protected function getContinueStr( $lastPageID ) {
443  return $this->rootTitle->getNamespace() .
444  '|' . $this->rootTitle->getDBkey() .
445  '|' . $lastPageID;
446  }
447 
448  protected function getContinueRedirStr( $lastPageID, $lastRedirID ) {
449  return $this->getContinueStr( $lastPageID ) . '|' . $lastRedirID;
450  }
451 
452  public function getAllowedParams() {
453  $retval = array(
454  'title' => array(
455  ApiBase::PARAM_TYPE => 'string',
456  ),
457  'pageid' => array(
458  ApiBase::PARAM_TYPE => 'integer',
459  ),
460  'continue' => null,
461  'namespace' => array(
462  ApiBase::PARAM_ISMULTI => true,
463  ApiBase::PARAM_TYPE => 'namespace'
464  ),
465  'dir' => array(
466  ApiBase::PARAM_DFLT => 'ascending',
468  'ascending',
469  'descending'
470  )
471  ),
472  'filterredir' => array(
473  ApiBase::PARAM_DFLT => 'all',
475  'all',
476  'redirects',
477  'nonredirects'
478  )
479  ),
480  'limit' => array(
481  ApiBase::PARAM_DFLT => 10,
482  ApiBase::PARAM_TYPE => 'limit',
483  ApiBase::PARAM_MIN => 1,
486  )
487  );
488  if ( $this->getModuleName() == 'embeddedin' ) {
489  return $retval;
490  }
491  $retval['redirect'] = false;
492 
493  return $retval;
494  }
495 
496  public function getParamDescription() {
497  $retval = array(
498  'title' => "Title to search. Cannot be used together with {$this->bl_code}pageid",
499  'pageid' => "Pageid to search. Cannot be used together with {$this->bl_code}title",
500  'continue' => 'When more results are available, use this to continue',
501  'namespace' => 'The namespace to enumerate',
502  'dir' => 'The direction in which to list',
503  );
504  if ( $this->getModuleName() != 'embeddedin' ) {
505  return array_merge( $retval, array(
506  'redirect' => 'If linking page is a redirect, find all pages ' .
507  'that link to that redirect as well. Maximum limit is halved.',
508  'filterredir' => 'How to filter for redirects. If set to ' .
509  "nonredirects when {$this->bl_code}redirect is enabled, " .
510  'this is only applied to the second level',
511  'limit' => 'How many total pages to return. If ' .
512  "{$this->bl_code}redirect is enabled, limit applies to each " .
513  'level separately (which means you may get up to 2 * limit results).'
514  ) );
515  }
516 
517  return array_merge( $retval, array(
518  'filterredir' => 'How to filter for redirects',
519  'limit' => 'How many total pages to return'
520  ) );
521  }
522 
523  public function getResultProperties() {
524  return array(
525  '' => array(
526  'pageid' => 'integer',
527  'ns' => 'namespace',
528  'title' => 'string',
529  'redirect' => 'boolean'
530  )
531  );
532  }
533 
534  public function getDescription() {
535  switch ( $this->getModuleName() ) {
536  case 'backlinks':
537  return 'Find all pages that link to the given page.';
538  case 'embeddedin':
539  return 'Find all pages that embed (transclude) the given title.';
540  case 'imageusage':
541  return 'Find all pages that use the given image title.';
542  default:
543  ApiBase::dieDebug( __METHOD__, 'Unknown module name.' );
544  }
545  }
546 
547  public function getPossibleErrors() {
548  return array_merge( parent::getPossibleErrors(),
549  $this->getTitleOrPageIdErrorMessage(),
550  array(
551  array(
552  'code' => 'bad_image_title',
553  'info' => "The title for {$this->getModuleName()} query must be an image"
554  ),
555  )
556  );
557  }
558 
559  public function getExamples() {
560  static $examples = array(
561  'backlinks' => array(
562  'api.php?action=query&list=backlinks&bltitle=Main%20Page',
563  'api.php?action=query&generator=backlinks&gbltitle=Main%20Page&prop=info'
564  ),
565  'embeddedin' => array(
566  'api.php?action=query&list=embeddedin&eititle=Template:Stub',
567  'api.php?action=query&generator=embeddedin&geititle=Template:Stub&prop=info'
568  ),
569  'imageusage' => array(
570  'api.php?action=query&list=imageusage&iutitle=File:Albert%20Einstein%20Head.jpg',
571  'api.php?action=query&generator=imageusage&giutitle=File:Albert%20Einstein%20Head.jpg&prop=info'
572  )
573  );
574 
575  return $examples[$this->getModuleName()];
576  }
577 
578  public function getHelpUrls() {
579  return $this->helpUrl;
580  }
581 }
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
$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
ApiQueryBase\addFields
addFields( $value)
Add a set of fields to select to the internal array.
Definition: ApiQueryBase.php:117
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
ApiQueryBase\resetQueryParams
resetQueryParams()
Blank the internal arrays with query parameters.
Definition: ApiQueryBase.php:68
ApiBase\PARAM_TYPE
const PARAM_TYPE
Definition: ApiBase.php:50
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:205
ApiQueryBase\select
select( $method, $extraQuery=array())
Execute a SELECT query based on the values in the internal arrays.
Definition: ApiQueryBase.php:274
$from
$from
Definition: importImages.php:90
NS_FILE
const NS_FILE
Definition: Defines.php:85
ApiQueryBase\addOption
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
Definition: ApiQueryBase.php:252
ApiBase\PARAM_MIN
const PARAM_MIN
Definition: ApiBase.php:56
LIST_OR
const LIST_OR
Definition: Defines.php:206
ApiBase\LIMIT_BIG1
const LIMIT_BIG1
Definition: ApiBase.php:78
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:417
ApiBase\PARAM_MAX
const PARAM_MAX
Definition: ApiBase.php:52
ApiQueryBase\addTables
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
Definition: ApiQueryBase.php:82
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
$sort
$sort
Definition: profileinfo.php:301
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
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
ApiQueryBase\addWhereFld
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
Definition: ApiQueryBase.php:185
$count
$count
Definition: UtfNormalTest2.php:96
ApiQueryGeneratorBase
Definition: ApiQueryBase.php:626
Title
Represents a title within MediaWiki.
Definition: Title.php:35
ApiBase\LIMIT_BIG2
const LIMIT_BIG2
Definition: ApiBase.php:79
ApiBase\validateLimit
validateLimit( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
Validate the value against the minimum and user/bot maximum limits.
Definition: ApiBase.php:1273
ApiBase\PARAM_DFLT
const PARAM_DFLT
Definition: ApiBase.php:46
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
ApiBase\getModuleName
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:148
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
Definition: ApiBase.php:48
ApiBase\PARAM_MAX2
const PARAM_MAX2
Definition: ApiBase.php:54
ApiBase\getMain
getMain()
Get the main module.
Definition: ApiBase.php:188
ApiQueryBase\addWhere
addWhere( $value)
Add a set of WHERE clauses to the internal array.
Definition: ApiQueryBase.php:152
$t
$t
Definition: testCompression.php:65
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
$res
$res
Definition: database.txt:21
ApiBase\dieDebug
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
Definition: ApiBase.php:2030
$retval
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 incomplete not yet checked for validity & $retval
Definition: hooks.txt:237
redirect
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second redirect
Definition: All_system_messages.txt:1267
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:339