MediaWiki  master
SpecialWhatLinksHere.php
Go to the documentation of this file.
1 <?php
26 
34  protected $opts;
35 
36  protected $selfTitle;
37 
39  protected $target;
40 
41  protected $limits = [ 20, 50, 100, 250, 500 ];
42 
43  public function __construct() {
44  parent::__construct( 'Whatlinkshere' );
45  }
46 
47  public function execute( $par ) {
48  $out = $this->getOutput();
49 
50  $this->setHeaders();
51  $this->outputHeader();
52  $this->addHelpLink( 'Help:What links here' );
53 
54  $opts = new FormOptions();
55 
56  $opts->add( 'target', '' );
57  $opts->add( 'namespace', '', FormOptions::INTNULL );
58  $opts->add( 'limit', $this->getConfig()->get( 'QueryPageDefaultLimit' ) );
59  $opts->add( 'from', 0 );
60  $opts->add( 'back', 0 );
61  $opts->add( 'hideredirs', false );
62  $opts->add( 'hidetrans', false );
63  $opts->add( 'hidelinks', false );
64  $opts->add( 'hideimages', false );
65  $opts->add( 'invert', false );
66 
68  $opts->validateIntBounds( 'limit', 0, 5000 );
69 
70  // Give precedence to subpage syntax
71  if ( $par !== null ) {
72  $opts->setValue( 'target', $par );
73  }
74 
75  // Bind to member variable
76  $this->opts = $opts;
77 
78  $this->target = Title::newFromText( $opts->getValue( 'target' ) );
79  if ( !$this->target ) {
80  if ( !$this->including() ) {
81  $out->addHTML( $this->whatlinkshereForm() );
82  }
83 
84  return;
85  }
86 
87  $this->getSkin()->setRelevantTitle( $this->target );
88 
89  $this->selfTitle = $this->getPageTitle( $this->target->getPrefixedDBkey() );
90 
91  $out->setPageTitle( $this->msg( 'whatlinkshere-title', $this->target->getPrefixedText() ) );
92  $out->addBacklinkSubtitle( $this->target );
93  $this->showIndirectLinks(
94  0,
95  $this->target,
96  $opts->getValue( 'limit' ),
97  $opts->getValue( 'from' ),
98  $opts->getValue( 'back' )
99  );
100  }
101 
109  private function showIndirectLinks( $level, $target, $limit, $from = 0, $back = 0 ) {
110  $out = $this->getOutput();
111  $dbr = wfGetDB( DB_REPLICA );
112 
113  $hidelinks = $this->opts->getValue( 'hidelinks' );
114  $hideredirs = $this->opts->getValue( 'hideredirs' );
115  $hidetrans = $this->opts->getValue( 'hidetrans' );
116  $hideimages = $target->getNamespace() != NS_FILE || $this->opts->getValue( 'hideimages' );
117 
118  // For historical reasons `pagelinks` always contains an entry for the redirect target.
119  // So we only need to query `redirect` if `pagelinks` isn't being queried.
120  $fetchredirs = $hidelinks && !$hideredirs;
121 
122  // Build query conds in concert for all four tables...
123  $conds = [];
124  $conds['redirect'] = [
125  'rd_namespace' => $target->getNamespace(),
126  'rd_title' => $target->getDBkey(),
127  ];
128  $conds['pagelinks'] = [
129  'pl_namespace' => $target->getNamespace(),
130  'pl_title' => $target->getDBkey(),
131  ];
132  $conds['templatelinks'] = [
133  'tl_namespace' => $target->getNamespace(),
134  'tl_title' => $target->getDBkey(),
135  ];
136  $conds['imagelinks'] = [
137  'il_to' => $target->getDBkey(),
138  ];
139 
140  $namespace = $this->opts->getValue( 'namespace' );
141  $invert = $this->opts->getValue( 'invert' );
142  $nsComparison = ( $invert ? '!= ' : '= ' ) . $dbr->addQuotes( $namespace );
143  if ( is_int( $namespace ) ) {
144  $conds['redirect'][] = "page_namespace $nsComparison";
145  $conds['pagelinks'][] = "pl_from_namespace $nsComparison";
146  $conds['templatelinks'][] = "tl_from_namespace $nsComparison";
147  $conds['imagelinks'][] = "il_from_namespace $nsComparison";
148  }
149 
150  if ( $from ) {
151  $conds['redirect'][] = "rd_from >= $from";
152  $conds['templatelinks'][] = "tl_from >= $from";
153  $conds['pagelinks'][] = "pl_from >= $from";
154  $conds['imagelinks'][] = "il_from >= $from";
155  }
156 
157  if ( $hideredirs ) {
158  // For historical reasons `pagelinks` always contains an entry for the redirect target.
159  // So we hide that link when $hideredirs is set. There's unfortunately no way to tell when a
160  // redirect's content also links to the target.
161  $conds['pagelinks']['rd_from'] = null;
162  }
163 
164  $queryFunc = function ( IDatabase $dbr, $table, $fromCol ) use (
165  $conds, $target, $limit
166  ) {
167  // Read an extra row as an at-end check
168  $queryLimit = $limit + 1;
169  $on = [
170  "rd_from = $fromCol",
171  'rd_title' => $target->getDBkey(),
172  'rd_interwiki = ' . $dbr->addQuotes( '' ) . ' OR rd_interwiki IS NULL'
173  ];
174  $on['rd_namespace'] = $target->getNamespace();
175  // Inner LIMIT is 2X in case of stale backlinks with wrong namespaces
176  $subQuery = $dbr->newSelectQueryBuilder()
177  ->table( $table )
178  ->fields( [ $fromCol, 'rd_from', 'rd_fragment' ] )
179  ->conds( $conds[$table] )
180  ->orderBy( $fromCol )
181  ->limit( 2 * $queryLimit )
182  ->leftJoin( 'redirect', 'redirect', $on )
183  ->join( 'page', 'page', "$fromCol = page_id" );
184 
185  return $dbr->newSelectQueryBuilder()
186  ->table( $subQuery, 'temp_backlink_range' )
187  ->join( 'page', 'page', "$fromCol = page_id" )
188  ->fields( [ 'page_id', 'page_namespace', 'page_title',
189  'rd_from', 'rd_fragment', 'page_is_redirect' ] )
190  ->orderBy( 'page_id' )
191  ->limit( $queryLimit )
192  ->caller( __CLASS__ . '::showIndirectLinks' )
193  ->fetchResultSet();
194  };
195 
196  if ( $fetchredirs ) {
197  $rdRes = $dbr->select(
198  [ 'redirect', 'page' ],
199  [ 'page_id', 'page_namespace', 'page_title', 'rd_from', 'rd_fragment', 'page_is_redirect' ],
200  $conds['redirect'],
201  __METHOD__,
202  [ 'ORDER BY' => 'rd_from', 'LIMIT' => $limit + 1 ],
203  [ 'page' => [ 'JOIN', 'rd_from = page_id' ] ]
204  );
205  }
206 
207  if ( !$hidelinks ) {
208  $plRes = $queryFunc( $dbr, 'pagelinks', 'pl_from' );
209  }
210 
211  if ( !$hidetrans ) {
212  $tlRes = $queryFunc( $dbr, 'templatelinks', 'tl_from' );
213  }
214 
215  if ( !$hideimages ) {
216  $ilRes = $queryFunc( $dbr, 'imagelinks', 'il_from' );
217  }
218 
219  if ( ( !$fetchredirs || !$rdRes->numRows() )
220  && ( $hidelinks || !$plRes->numRows() )
221  && ( $hidetrans || !$tlRes->numRows() )
222  && ( $hideimages || !$ilRes->numRows() )
223  ) {
224  if ( $level == 0 && !$this->including() ) {
225  $out->addHTML( $this->whatlinkshereForm() );
226 
227  // Show filters only if there are links
228  if ( $hidelinks || $hidetrans || $hideredirs || $hideimages ) {
229  $out->addHTML( $this->getFilterPanel() );
230  }
231  $msgKey = is_int( $namespace ) ? 'nolinkshere-ns' : 'nolinkshere';
232  $link = $this->getLinkRenderer()->makeLink(
233  $this->target,
234  null,
235  [],
236  $this->target->isRedirect() ? [ 'redirect' => 'no' ] : []
237  );
238 
239  $errMsg = $this->msg( $msgKey )
240  ->params( $this->target->getPrefixedText() )
241  ->rawParams( $link )
242  ->parseAsBlock();
243  $out->addHTML( $errMsg );
244  $out->setStatusCode( 404 );
245  }
246 
247  return;
248  }
249 
250  // Read the rows into an array and remove duplicates
251  // templatelinks comes third so that the templatelinks row overwrites the
252  // pagelinks/redirect row, so we get (inclusion) rather than nothing
253  $rows = [];
254  if ( $fetchredirs ) {
255  foreach ( $rdRes as $row ) {
256  $row->is_template = 0;
257  $row->is_image = 0;
258  $rows[$row->page_id] = $row;
259  }
260  }
261  if ( !$hidelinks ) {
262  foreach ( $plRes as $row ) {
263  $row->is_template = 0;
264  $row->is_image = 0;
265  $rows[$row->page_id] = $row;
266  }
267  }
268  if ( !$hidetrans ) {
269  foreach ( $tlRes as $row ) {
270  $row->is_template = 1;
271  $row->is_image = 0;
272  $rows[$row->page_id] = $row;
273  }
274  }
275  if ( !$hideimages ) {
276  foreach ( $ilRes as $row ) {
277  $row->is_template = 0;
278  $row->is_image = 1;
279  $rows[$row->page_id] = $row;
280  }
281  }
282 
283  // Sort by key and then change the keys to 0-based indices
284  ksort( $rows );
285  $rows = array_values( $rows );
286 
287  $numRows = count( $rows );
288 
289  // Work out the start and end IDs, for prev/next links
290  if ( $numRows > $limit ) {
291  // More rows available after these ones
292  // Get the ID from the last row in the result set
293  $nextId = $rows[$limit]->page_id;
294  // Remove undisplayed rows
295  $rows = array_slice( $rows, 0, $limit );
296  } else {
297  // No more rows after
298  $nextId = false;
299  }
300  $prevId = $from;
301 
302  // use LinkBatch to make sure, that all required data (associated with Titles)
303  // is loaded in one query
304  $lb = new LinkBatch();
305  foreach ( $rows as $row ) {
306  $lb->add( $row->page_namespace, $row->page_title );
307  }
308  $lb->execute();
309 
310  if ( $level == 0 && !$this->including() ) {
311  $out->addHTML( $this->whatlinkshereForm() );
312  $out->addHTML( $this->getFilterPanel() );
313 
314  $link = $this->getLinkRenderer()->makeLink(
315  $this->target,
316  null,
317  [],
318  $this->target->isRedirect() ? [ 'redirect' => 'no' ] : []
319  );
320 
321  $msg = $this->msg( 'linkshere' )
322  ->params( $this->target->getPrefixedText() )
323  ->rawParams( $link )
324  ->parseAsBlock();
325  $out->addHTML( $msg );
326 
327  $out->addWikiMsg( 'whatlinkshere-count', Message::numParam( count( $rows ) ) );
328 
329  $prevnext = $this->getPrevNext( $prevId, $nextId );
330  $out->addHTML( $prevnext );
331  }
332  $out->addHTML( $this->listStart( $level ) );
333  foreach ( $rows as $row ) {
334  $nt = Title::makeTitle( $row->page_namespace, $row->page_title );
335 
336  if ( $row->rd_from && $level < 2 ) {
337  $out->addHTML( $this->listItem( $row, $nt, $target, true ) );
338  $this->showIndirectLinks(
339  $level + 1,
340  $nt,
341  $this->getConfig()->get( 'MaxRedirectLinksRetrieved' )
342  );
343  $out->addHTML( Xml::closeElement( 'li' ) );
344  } else {
345  $out->addHTML( $this->listItem( $row, $nt, $target ) );
346  }
347  }
348 
349  $out->addHTML( $this->listEnd() );
350 
351  if ( $level == 0 && !$this->including() ) {
352  $out->addHTML( $prevnext );
353  }
354  }
355 
356  protected function listStart( $level ) {
357  return Xml::openElement( 'ul', ( $level ? [] : [ 'id' => 'mw-whatlinkshere-list' ] ) );
358  }
359 
360  protected function listItem( $row, $nt, $target, $notClose = false ) {
361  $dirmark = $this->getLanguage()->getDirMark();
362 
363  # local message cache
364  static $msgcache = null;
365  if ( $msgcache === null ) {
366  static $msgs = [ 'isredirect', 'istemplate', 'semicolon-separator',
367  'whatlinkshere-links', 'isimage', 'editlink' ];
368  $msgcache = [];
369  foreach ( $msgs as $msg ) {
370  $msgcache[$msg] = $this->msg( $msg )->escaped();
371  }
372  }
373 
374  if ( $row->rd_from ) {
375  $query = [ 'redirect' => 'no' ];
376  } else {
377  $query = [];
378  }
379 
380  $link = $this->getLinkRenderer()->makeKnownLink(
381  $nt,
382  null,
383  $row->page_is_redirect ? [ 'class' => 'mw-redirect' ] : [],
384  $query
385  );
386 
387  // Display properties (redirect or template)
388  $propsText = '';
389  $props = [];
390  if ( (string)$row->rd_fragment !== '' ) {
391  $props[] = $this->msg( 'whatlinkshere-sectionredir' )
392  ->rawParams( $this->getLinkRenderer()->makeLink(
393  $target->createFragmentTarget( $row->rd_fragment ),
394  $row->rd_fragment
395  ) )->escaped();
396  } elseif ( $row->rd_from ) {
397  $props[] = $msgcache['isredirect'];
398  }
399  if ( $row->is_template ) {
400  $props[] = $msgcache['istemplate'];
401  }
402  if ( $row->is_image ) {
403  $props[] = $msgcache['isimage'];
404  }
405 
406  $this->getHookRunner()->onWhatLinksHereProps( $row, $nt, $target, $props );
407 
408  if ( count( $props ) ) {
409  $propsText = $this->msg( 'parentheses' )
410  ->rawParams( implode( $msgcache['semicolon-separator'], $props ) )->escaped();
411  }
412 
413  # Space for utilities links, with a what-links-here link provided
414  $wlhLink = $this->wlhLink( $nt, $msgcache['whatlinkshere-links'], $msgcache['editlink'] );
415  $wlh = Xml::wrapClass(
416  $this->msg( 'parentheses' )->rawParams( $wlhLink )->escaped(),
417  'mw-whatlinkshere-tools'
418  );
419 
420  return $notClose ?
421  Xml::openElement( 'li' ) . "$link $propsText $dirmark $wlh\n" :
422  Xml::tags( 'li', null, "$link $propsText $dirmark $wlh" ) . "\n";
423  }
424 
425  protected function listEnd() {
426  return Xml::closeElement( 'ul' );
427  }
428 
429  protected function wlhLink( Title $target, $text, $editText ) {
430  static $title = null;
431  if ( $title === null ) {
432  $title = $this->getPageTitle();
433  }
434 
435  $linkRenderer = $this->getLinkRenderer();
436 
437  if ( $text !== null ) {
438  $text = new HtmlArmor( $text );
439  }
440 
441  // always show a "<- Links" link
442  $links = [
443  'links' => $linkRenderer->makeKnownLink(
444  $title,
445  $text,
446  [],
447  [ 'target' => $target->getPrefixedText() ]
448  ),
449  ];
450 
451  // if the page is editable, add an edit link
452  if (
453  // check user permissions
454  MediaWikiServices::getInstance()
456  ->userHasRight( $this->getUser(), 'edit' ) &&
457  // check, if the content model is editable through action=edit
458  MediaWikiServices::getInstance()
459  ->getContentHandlerFactory()
460  ->getContentHandler( $target->getContentModel() )
461  ->supportsDirectEditing()
462  ) {
463  if ( $editText !== null ) {
464  $editText = new HtmlArmor( $editText );
465  }
466 
467  $links['edit'] = $linkRenderer->makeKnownLink(
468  $target,
469  $editText,
470  [],
471  [ 'action' => 'edit' ]
472  );
473  }
474 
475  // build the links html
476  return $this->getLanguage()->pipeList( $links );
477  }
478 
479  private function makeSelfLink( $text, $query ) {
480  if ( $text !== null ) {
481  $text = new HtmlArmor( $text );
482  }
483 
484  return $this->getLinkRenderer()->makeKnownLink(
485  $this->selfTitle,
486  $text,
487  [],
488  $query
489  );
490  }
491 
492  private function getPrevNext( $prevId, $nextId ) {
493  $currentLimit = $this->opts->getValue( 'limit' );
494  $prev = $this->msg( 'whatlinkshere-prev' )->numParams( $currentLimit )->escaped();
495  $next = $this->msg( 'whatlinkshere-next' )->numParams( $currentLimit )->escaped();
496 
497  $changed = $this->opts->getChangedValues();
498  unset( $changed['target'] ); // Already in the request title
499 
500  if ( $prevId != 0 ) {
501  $overrides = [ 'from' => $this->opts->getValue( 'back' ) ];
502  $prev = $this->makeSelfLink( $prev, array_merge( $changed, $overrides ) );
503  }
504  if ( $nextId != 0 ) {
505  $overrides = [ 'from' => $nextId, 'back' => $prevId ];
506  $next = $this->makeSelfLink( $next, array_merge( $changed, $overrides ) );
507  }
508 
509  $limitLinks = [];
510  $lang = $this->getLanguage();
511  foreach ( $this->limits as $limit ) {
512  $prettyLimit = htmlspecialchars( $lang->formatNum( $limit ) );
513  $overrides = [ 'limit' => $limit ];
514  $limitLinks[] = $this->makeSelfLink( $prettyLimit, array_merge( $changed, $overrides ) );
515  }
516 
517  $nums = $lang->pipeList( $limitLinks );
518 
519  return $this->msg( 'viewprevnext' )->rawParams( $prev, $next, $nums )->escaped();
520  }
521 
522  private function whatlinkshereForm() {
523  // We get nicer value from the title object
524  $this->opts->consumeValue( 'target' );
525  // Reset these for new requests
526  $this->opts->consumeValues( [ 'back', 'from' ] );
527 
528  $target = $this->target ? $this->target->getPrefixedText() : '';
529  $namespace = $this->opts->consumeValue( 'namespace' );
530  $nsinvert = $this->opts->consumeValue( 'invert' );
531 
532  # Build up the form
533  $f = Xml::openElement( 'form', [ 'action' => wfScript() ] );
534 
535  # Values that should not be forgotten
536  $f .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
537  foreach ( $this->opts->getUnconsumedValues() as $name => $value ) {
538  $f .= Html::hidden( $name, $value );
539  }
540 
541  $f .= Xml::fieldset( $this->msg( 'whatlinkshere' )->text() );
542 
543  # Target input (.mw-searchInput enables suggestions)
544  $f .= Xml::inputLabel( $this->msg( 'whatlinkshere-page' )->text(), 'target',
545  'mw-whatlinkshere-target', 40, $target, [ 'class' => 'mw-searchInput' ] );
546 
547  $f .= ' ';
548 
549  # Namespace selector
551  [
552  'selected' => $namespace,
553  'all' => '',
554  'label' => $this->msg( 'namespace' )->text(),
555  'in-user-lang' => true,
556  ], [
557  'name' => 'namespace',
558  'id' => 'namespace',
559  'class' => 'namespaceselector',
560  ]
561  );
562 
563  $f .= "\u{00A0}" .
565  $this->msg( 'invert' )->text(),
566  'invert',
567  'nsinvert',
568  $nsinvert,
569  [ 'title' => $this->msg( 'tooltip-whatlinkshere-invert' )->text() ]
570  );
571 
572  $f .= ' ';
573 
574  # Submit
575  $f .= Xml::submitButton( $this->msg( 'whatlinkshere-submit' )->text() );
576 
577  # Close
578  $f .= Xml::closeElement( 'fieldset' ) . Xml::closeElement( 'form' ) . "\n";
579 
580  return $f;
581  }
582 
588  private function getFilterPanel() {
589  $show = $this->msg( 'show' )->escaped();
590  $hide = $this->msg( 'hide' )->escaped();
591 
592  $changed = $this->opts->getChangedValues();
593  unset( $changed['target'] ); // Already in the request title
594 
595  $links = [];
596  $types = [ 'hidetrans', 'hidelinks', 'hideredirs' ];
597  if ( $this->target->getNamespace() == NS_FILE ) {
598  $types[] = 'hideimages';
599  }
600 
601  // Combined message keys: 'whatlinkshere-hideredirs', 'whatlinkshere-hidetrans',
602  // 'whatlinkshere-hidelinks', 'whatlinkshere-hideimages'
603  // To be sure they will be found by grep
604  foreach ( $types as $type ) {
605  $chosen = $this->opts->getValue( $type );
606  $msg = $chosen ? $show : $hide;
607  $overrides = [ $type => !$chosen ];
608  $links[] = $this->msg( "whatlinkshere-{$type}" )->rawParams(
609  $this->makeSelfLink( $msg, array_merge( $changed, $overrides ) ) )->escaped();
610  }
611 
612  return Xml::fieldset(
613  $this->msg( 'whatlinkshere-filters' )->text(),
614  $this->getLanguage()->pipeList( $links )
615  );
616  }
617 
626  public function prefixSearchSubpages( $search, $limit, $offset ) {
627  return $this->prefixSearchString( $search, $limit, $offset );
628  }
629 
630  protected function getGroupName() {
631  return 'pagetools';
632  }
633 }
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:669
Message\numParam
static numParam( $num)
Definition: Message.php:1046
SpecialWhatLinksHere\__construct
__construct()
Definition: SpecialWhatLinksHere.php:43
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:800
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:329
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:28
SpecialWhatLinksHere\$limits
$limits
Definition: SpecialWhatLinksHere.php:41
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:35
SpecialWhatLinksHere\listEnd
listEnd()
Definition: SpecialWhatLinksHere.php:425
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:716
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:152
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:37
FormOptions\getValue
getValue( $name)
Get the value for the given option name.
Definition: FormOptions.php:182
FormOptions\INTNULL
const INTNULL
Integer type or null, maps to WebRequest::getIntOrNull() This is useful for the namespace selector.
Definition: FormOptions.php:55
Title\getPrefixedText
getPrefixedText()
Get the prefixed title with spaces.
Definition: Title.php:1850
NS_FILE
const NS_FILE
Definition: Defines.php:75
SpecialWhatLinksHere\whatlinkshereForm
whatlinkshereForm()
Definition: SpecialWhatLinksHere.php:522
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:736
SpecialWhatLinksHere\prefixSearchSubpages
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
Definition: SpecialWhatLinksHere.php:626
IncludableSpecialPage
Shortcut to construct an includable special page.
Definition: IncludableSpecialPage.php:29
FormOptions\validateIntBounds
validateIntBounds( $name, $min, $max)
Definition: FormOptions.php:255
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:746
FormOptions\fetchValuesFromRequest
fetchValuesFromRequest(WebRequest $r, $optionKeys=null)
Fetch values for all options (or selected options) from the given WebRequest, making them available f...
Definition: FormOptions.php:346
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:108
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
$dbr
$dbr
Definition: testCompression.php:54
Xml\fieldset
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:613
FormOptions\add
add( $name, $default, $type=self::AUTO)
Add an option to be handled by this FormOptions instance.
Definition: FormOptions.php:83
SpecialPage\addHelpLink
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition: SpecialPage.php:836
SpecialPage\prefixSearchString
prefixSearchString( $search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
Definition: SpecialPage.php:515
Xml\wrapClass
static wrapClass( $text, $class, $tag='span', $attribs=[])
Shortcut to make a specific element with a class attribute.
Definition: Xml.php:266
Title\getDBkey
getDBkey()
Get the main part with underscores.
Definition: Title.php:1023
SpecialPage\getHookRunner
getHookRunner()
Definition: SpecialPage.php:978
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:766
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:2531
Title\getNamespace
getNamespace()
Get the namespace index, i.e.
Definition: Title.php:1032
SpecialWhatLinksHere\getPrevNext
getPrevNext( $prevId, $nextId)
Definition: SpecialWhatLinksHere.php:492
getPermissionManager
getPermissionManager()
SpecialWhatLinksHere\wlhLink
wlhLink(Title $target, $text, $editText)
Definition: SpecialWhatLinksHere.php:429
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2464
SpecialWhatLinksHere\showIndirectLinks
showIndirectLinks( $level, $target, $limit, $from=0, $back=0)
Definition: SpecialWhatLinksHere.php:109
SpecialWhatLinksHere
Implements Special:Whatlinkshere.
Definition: SpecialWhatLinksHere.php:32
$title
$title
Definition: testCompression.php:38
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:551
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:726
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:592
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
FormOptions\setValue
setValue( $name, $value, $force=false)
Use to set the value of an option.
Definition: FormOptions.php:165
Title\createFragmentTarget
createFragmentTarget( $fragment)
Creates a new Title for a different fragment of the same page.
Definition: Title.php:1796
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:802
Html\namespaceSelector
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
Definition: Html.php:894
Xml\tags
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:130
SpecialWhatLinksHere\execute
execute( $par)
Default execute method Checks user permissions.
Definition: SpecialWhatLinksHere.php:47
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:706
Title\getContentModel
getContentModel( $flags=0)
Get the page's content model id, see the CONTENT_MODEL_XXX constants.
Definition: Title.php:1044
SpecialWhatLinksHere\makeSelfLink
makeSelfLink( $text, $query)
Definition: SpecialWhatLinksHere.php:479
SpecialWhatLinksHere\$selfTitle
$selfTitle
Definition: SpecialWhatLinksHere.php:36
SpecialWhatLinksHere\listItem
listItem( $row, $nt, $target, $notClose=false)
Definition: SpecialWhatLinksHere.php:360
SpecialWhatLinksHere\$target
Title $target
Definition: SpecialWhatLinksHere.php:39
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:912
Title
Represents a title within MediaWiki.
Definition: Title.php:42
SpecialWhatLinksHere\listStart
listStart( $level)
Definition: SpecialWhatLinksHere.php:356
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:117
SpecialWhatLinksHere\getFilterPanel
getFilterPanel()
Create filter panel.
Definition: SpecialWhatLinksHere.php:588
FormOptions
Helper class to keep track of options when mixing links and form elements.
Definition: FormOptions.php:35
SpecialPage\$linkRenderer
MediaWiki Linker LinkRenderer null $linkRenderer
Definition: SpecialPage.php:69
Xml\inputLabel
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field with a label.
Definition: Xml.php:384
SpecialWhatLinksHere\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialWhatLinksHere.php:630
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:636
SpecialPage\including
including( $x=null)
Whether the special page is being evaluated via transclusion.
Definition: SpecialPage.php:243
SpecialWhatLinksHere\$opts
FormOptions $opts
Definition: SpecialWhatLinksHere.php:34
Xml\submitButton
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:463
Xml\checkLabel
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:423
$type
$type
Definition: testCompression.php:52