MediaWiki  1.27.2
SpecialWhatlinkshere.php
Go to the documentation of this file.
1 <?php
31  protected $opts;
32 
33  protected $selfTitle;
34 
36  protected $target;
37 
38  protected $limits = [ 20, 50, 100, 250, 500 ];
39 
40  public function __construct() {
41  parent::__construct( 'Whatlinkshere' );
42  }
43 
44  function execute( $par ) {
45  $out = $this->getOutput();
46 
47  $this->setHeaders();
48  $this->outputHeader();
49  $this->addHelpLink( 'Help:What links here' );
50 
51  $opts = new FormOptions();
52 
53  $opts->add( 'target', '' );
54  $opts->add( 'namespace', '', FormOptions::INTNULL );
55  $opts->add( 'limit', $this->getConfig()->get( 'QueryPageDefaultLimit' ) );
56  $opts->add( 'from', 0 );
57  $opts->add( 'back', 0 );
58  $opts->add( 'hideredirs', false );
59  $opts->add( 'hidetrans', false );
60  $opts->add( 'hidelinks', false );
61  $opts->add( 'hideimages', false );
62  $opts->add( 'invert', false );
63 
65  $opts->validateIntBounds( 'limit', 0, 5000 );
66 
67  // Give precedence to subpage syntax
68  if ( $par !== null ) {
69  $opts->setValue( 'target', $par );
70  }
71 
72  // Bind to member variable
73  $this->opts = $opts;
74 
75  $this->target = Title::newFromText( $opts->getValue( 'target' ) );
76  if ( !$this->target ) {
77  if ( !$this->including() ) {
78  $out->addHTML( $this->whatlinkshereForm() );
79  }
80 
81  return;
82  }
83 
84  $this->getSkin()->setRelevantTitle( $this->target );
85 
86  $this->selfTitle = $this->getPageTitle( $this->target->getPrefixedDBkey() );
87 
88  $out->setPageTitle( $this->msg( 'whatlinkshere-title', $this->target->getPrefixedText() ) );
89  $out->addBacklinkSubtitle( $this->target );
90  $this->showIndirectLinks(
91  0,
92  $this->target,
93  $opts->getValue( 'limit' ),
94  $opts->getValue( 'from' ),
95  $opts->getValue( 'back' )
96  );
97  }
98 
106  function showIndirectLinks( $level, $target, $limit, $from = 0, $back = 0 ) {
107  $out = $this->getOutput();
108  $dbr = wfGetDB( DB_SLAVE );
109 
110  $hidelinks = $this->opts->getValue( 'hidelinks' );
111  $hideredirs = $this->opts->getValue( 'hideredirs' );
112  $hidetrans = $this->opts->getValue( 'hidetrans' );
113  $hideimages = $target->getNamespace() != NS_FILE || $this->opts->getValue( 'hideimages' );
114 
115  $fetchlinks = ( !$hidelinks || !$hideredirs );
116 
117  // Build query conds in concert for all three tables...
118  $conds['pagelinks'] = [
119  'pl_namespace' => $target->getNamespace(),
120  'pl_title' => $target->getDBkey(),
121  ];
122  $conds['templatelinks'] = [
123  'tl_namespace' => $target->getNamespace(),
124  'tl_title' => $target->getDBkey(),
125  ];
126  $conds['imagelinks'] = [
127  'il_to' => $target->getDBkey(),
128  ];
129 
130  $namespace = $this->opts->getValue( 'namespace' );
131  $invert = $this->opts->getValue( 'invert' );
132  $nsComparison = ( $invert ? '!= ' : '= ' ) . $dbr->addQuotes( $namespace );
133  if ( is_int( $namespace ) ) {
134  $conds['pagelinks'][] = "pl_from_namespace $nsComparison";
135  $conds['templatelinks'][] = "tl_from_namespace $nsComparison";
136  $conds['imagelinks'][] = "il_from_namespace $nsComparison";
137  }
138 
139  if ( $from ) {
140  $conds['templatelinks'][] = "tl_from >= $from";
141  $conds['pagelinks'][] = "pl_from >= $from";
142  $conds['imagelinks'][] = "il_from >= $from";
143  }
144 
145  if ( $hideredirs ) {
146  $conds['pagelinks']['rd_from'] = null;
147  } elseif ( $hidelinks ) {
148  $conds['pagelinks'][] = 'rd_from is NOT NULL';
149  }
150 
151  $queryFunc = function ( IDatabase $dbr, $table, $fromCol ) use (
152  $conds, $target, $limit
153  ) {
154  // Read an extra row as an at-end check
155  $queryLimit = $limit + 1;
156  $on = [
157  "rd_from = $fromCol",
158  'rd_title' => $target->getDBkey(),
159  'rd_interwiki = ' . $dbr->addQuotes( '' ) . ' OR rd_interwiki IS NULL'
160  ];
161  $on['rd_namespace'] = $target->getNamespace();
162  // Inner LIMIT is 2X in case of stale backlinks with wrong namespaces
163  $subQuery = $dbr->selectSQLText(
164  [ $table, 'redirect', 'page' ],
165  [ $fromCol, 'rd_from' ],
166  $conds[$table],
167  __CLASS__ . '::showIndirectLinks',
168  // Force JOIN order per T106682 to avoid large filesorts
169  [ 'ORDER BY' => $fromCol, 'LIMIT' => 2 * $queryLimit, 'STRAIGHT_JOIN' ],
170  [
171  'page' => [ 'INNER JOIN', "$fromCol = page_id" ],
172  'redirect' => [ 'LEFT JOIN', $on ]
173  ]
174  );
175  return $dbr->select(
176  [ 'page', 'temp_backlink_range' => "($subQuery)" ],
177  [ 'page_id', 'page_namespace', 'page_title', 'rd_from', 'page_is_redirect' ],
178  [],
179  __CLASS__ . '::showIndirectLinks',
180  [ 'ORDER BY' => 'page_id', 'LIMIT' => $queryLimit ],
181  [ 'page' => [ 'INNER JOIN', "$fromCol = page_id" ] ]
182  );
183  };
184 
185  if ( $fetchlinks ) {
186  $plRes = $queryFunc( $dbr, 'pagelinks', 'pl_from' );
187  }
188 
189  if ( !$hidetrans ) {
190  $tlRes = $queryFunc( $dbr, 'templatelinks', 'tl_from' );
191  }
192 
193  if ( !$hideimages ) {
194  $ilRes = $queryFunc( $dbr, 'imagelinks', 'il_from' );
195  }
196 
197  if ( ( !$fetchlinks || !$plRes->numRows() )
198  && ( $hidetrans || !$tlRes->numRows() )
199  && ( $hideimages || !$ilRes->numRows() )
200  ) {
201  if ( 0 == $level ) {
202  if ( !$this->including() ) {
203  $out->addHTML( $this->whatlinkshereForm() );
204 
205  // Show filters only if there are links
206  if ( $hidelinks || $hidetrans || $hideredirs || $hideimages ) {
207  $out->addHTML( $this->getFilterPanel() );
208  }
209  $errMsg = is_int( $namespace ) ? 'nolinkshere-ns' : 'nolinkshere';
210  $out->addWikiMsg( $errMsg, $this->target->getPrefixedText() );
211  $out->setStatusCode( 404 );
212  }
213  }
214 
215  return;
216  }
217 
218  // Read the rows into an array and remove duplicates
219  // templatelinks comes second so that the templatelinks row overwrites the
220  // pagelinks row, so we get (inclusion) rather than nothing
221  if ( $fetchlinks ) {
222  foreach ( $plRes as $row ) {
223  $row->is_template = 0;
224  $row->is_image = 0;
225  $rows[$row->page_id] = $row;
226  }
227  }
228  if ( !$hidetrans ) {
229  foreach ( $tlRes as $row ) {
230  $row->is_template = 1;
231  $row->is_image = 0;
232  $rows[$row->page_id] = $row;
233  }
234  }
235  if ( !$hideimages ) {
236  foreach ( $ilRes as $row ) {
237  $row->is_template = 0;
238  $row->is_image = 1;
239  $rows[$row->page_id] = $row;
240  }
241  }
242 
243  // Sort by key and then change the keys to 0-based indices
244  ksort( $rows );
245  $rows = array_values( $rows );
246 
247  $numRows = count( $rows );
248 
249  // Work out the start and end IDs, for prev/next links
250  if ( $numRows > $limit ) {
251  // More rows available after these ones
252  // Get the ID from the last row in the result set
253  $nextId = $rows[$limit]->page_id;
254  // Remove undisplayed rows
255  $rows = array_slice( $rows, 0, $limit );
256  } else {
257  // No more rows after
258  $nextId = false;
259  }
260  $prevId = $from;
261 
262  // use LinkBatch to make sure, that all required data (associated with Titles)
263  // is loaded in one query
264  $lb = new LinkBatch();
265  foreach ( $rows as $row ) {
266  $lb->add( $row->page_namespace, $row->page_title );
267  }
268  $lb->execute();
269 
270  if ( $level == 0 ) {
271  if ( !$this->including() ) {
272  $out->addHTML( $this->whatlinkshereForm() );
273  $out->addHTML( $this->getFilterPanel() );
274  $out->addWikiMsg( 'linkshere', $this->target->getPrefixedText() );
275 
276  $prevnext = $this->getPrevNext( $prevId, $nextId );
277  $out->addHTML( $prevnext );
278  }
279  }
280  $out->addHTML( $this->listStart( $level ) );
281  foreach ( $rows as $row ) {
282  $nt = Title::makeTitle( $row->page_namespace, $row->page_title );
283 
284  if ( $row->rd_from && $level < 2 ) {
285  $out->addHTML( $this->listItem( $row, $nt, $target, true ) );
286  $this->showIndirectLinks(
287  $level + 1,
288  $nt,
289  $this->getConfig()->get( 'MaxRedirectLinksRetrieved' )
290  );
291  $out->addHTML( Xml::closeElement( 'li' ) );
292  } else {
293  $out->addHTML( $this->listItem( $row, $nt, $target ) );
294  }
295  }
296 
297  $out->addHTML( $this->listEnd() );
298 
299  if ( $level == 0 ) {
300  if ( !$this->including() ) {
301  $out->addHTML( $prevnext );
302  }
303  }
304  }
305 
306  protected function listStart( $level ) {
307  return Xml::openElement( 'ul', ( $level ? [] : [ 'id' => 'mw-whatlinkshere-list' ] ) );
308  }
309 
310  protected function listItem( $row, $nt, $target, $notClose = false ) {
311  $dirmark = $this->getLanguage()->getDirMark();
312 
313  # local message cache
314  static $msgcache = null;
315  if ( $msgcache === null ) {
316  static $msgs = [ 'isredirect', 'istemplate', 'semicolon-separator',
317  'whatlinkshere-links', 'isimage', 'editlink' ];
318  $msgcache = [];
319  foreach ( $msgs as $msg ) {
320  $msgcache[$msg] = $this->msg( $msg )->escaped();
321  }
322  }
323 
324  if ( $row->rd_from ) {
325  $query = [ 'redirect' => 'no' ];
326  } else {
327  $query = [];
328  }
329 
331  $nt,
332  null,
333  $row->page_is_redirect ? [ 'class' => 'mw-redirect' ] : [],
334  $query
335  );
336 
337  // Display properties (redirect or template)
338  $propsText = '';
339  $props = [];
340  if ( $row->rd_from ) {
341  $props[] = $msgcache['isredirect'];
342  }
343  if ( $row->is_template ) {
344  $props[] = $msgcache['istemplate'];
345  }
346  if ( $row->is_image ) {
347  $props[] = $msgcache['isimage'];
348  }
349 
350  Hooks::run( 'WhatLinksHereProps', [ $row, $nt, $target, &$props ] );
351 
352  if ( count( $props ) ) {
353  $propsText = $this->msg( 'parentheses' )
354  ->rawParams( implode( $msgcache['semicolon-separator'], $props ) )->escaped();
355  }
356 
357  # Space for utilities links, with a what-links-here link provided
358  $wlhLink = $this->wlhLink( $nt, $msgcache['whatlinkshere-links'], $msgcache['editlink'] );
359  $wlh = Xml::wrapClass(
360  $this->msg( 'parentheses' )->rawParams( $wlhLink )->escaped(),
361  'mw-whatlinkshere-tools'
362  );
363 
364  return $notClose ?
365  Xml::openElement( 'li' ) . "$link $propsText $dirmark $wlh\n" :
366  Xml::tags( 'li', null, "$link $propsText $dirmark $wlh" ) . "\n";
367  }
368 
369  protected function listEnd() {
370  return Xml::closeElement( 'ul' );
371  }
372 
373  protected function wlhLink( Title $target, $text, $editText ) {
374  static $title = null;
375  if ( $title === null ) {
376  $title = $this->getPageTitle();
377  }
378 
379  // always show a "<- Links" link
380  $links = [
381  'links' => Linker::linkKnown(
382  $title,
383  $text,
384  [],
385  [ 'target' => $target->getPrefixedText() ]
386  ),
387  ];
388 
389  // if the page is editable, add an edit link
390  if (
391  // check user permissions
392  $this->getUser()->isAllowed( 'edit' ) &&
393  // check, if the content model is editable through action=edit
394  ContentHandler::getForTitle( $target )->supportsDirectEditing()
395  ) {
396  $links['edit'] = Linker::linkKnown(
397  $target,
398  $editText,
399  [],
400  [ 'action' => 'edit' ]
401  );
402  }
403 
404  // build the links html
405  return $this->getLanguage()->pipeList( $links );
406  }
407 
408  function makeSelfLink( $text, $query ) {
409  return Linker::linkKnown(
410  $this->selfTitle,
411  $text,
412  [],
413  $query
414  );
415  }
416 
417  function getPrevNext( $prevId, $nextId ) {
418  $currentLimit = $this->opts->getValue( 'limit' );
419  $prev = $this->msg( 'whatlinkshere-prev' )->numParams( $currentLimit )->escaped();
420  $next = $this->msg( 'whatlinkshere-next' )->numParams( $currentLimit )->escaped();
421 
422  $changed = $this->opts->getChangedValues();
423  unset( $changed['target'] ); // Already in the request title
424 
425  if ( 0 != $prevId ) {
426  $overrides = [ 'from' => $this->opts->getValue( 'back' ) ];
427  $prev = $this->makeSelfLink( $prev, array_merge( $changed, $overrides ) );
428  }
429  if ( 0 != $nextId ) {
430  $overrides = [ 'from' => $nextId, 'back' => $prevId ];
431  $next = $this->makeSelfLink( $next, array_merge( $changed, $overrides ) );
432  }
433 
434  $limitLinks = [];
435  $lang = $this->getLanguage();
436  foreach ( $this->limits as $limit ) {
437  $prettyLimit = htmlspecialchars( $lang->formatNum( $limit ) );
438  $overrides = [ 'limit' => $limit ];
439  $limitLinks[] = $this->makeSelfLink( $prettyLimit, array_merge( $changed, $overrides ) );
440  }
441 
442  $nums = $lang->pipeList( $limitLinks );
443 
444  return $this->msg( 'viewprevnext' )->rawParams( $prev, $next, $nums )->escaped();
445  }
446 
447  function whatlinkshereForm() {
448  // We get nicer value from the title object
449  $this->opts->consumeValue( 'target' );
450  // Reset these for new requests
451  $this->opts->consumeValues( [ 'back', 'from' ] );
452 
453  $target = $this->target ? $this->target->getPrefixedText() : '';
454  $namespace = $this->opts->consumeValue( 'namespace' );
455  $nsinvert = $this->opts->consumeValue( 'invert' );
456 
457  # Build up the form
458  $f = Xml::openElement( 'form', [ 'action' => wfScript() ] );
459 
460  # Values that should not be forgotten
461  $f .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
462  foreach ( $this->opts->getUnconsumedValues() as $name => $value ) {
463  $f .= Html::hidden( $name, $value );
464  }
465 
466  $f .= Xml::fieldset( $this->msg( 'whatlinkshere' )->text() );
467 
468  # Target input (.mw-searchInput enables suggestions)
469  $f .= Xml::inputLabel( $this->msg( 'whatlinkshere-page' )->text(), 'target',
470  'mw-whatlinkshere-target', 40, $target, [ 'class' => 'mw-searchInput' ] );
471 
472  $f .= ' ';
473 
474  # Namespace selector
476  [
477  'selected' => $namespace,
478  'all' => '',
479  'label' => $this->msg( 'namespace' )->text()
480  ], [
481  'name' => 'namespace',
482  'id' => 'namespace',
483  'class' => 'namespaceselector',
484  ]
485  );
486 
487  $f .= '&#160;' .
489  $this->msg( 'invert' )->text(),
490  'invert',
491  'nsinvert',
492  $nsinvert,
493  [ 'title' => $this->msg( 'tooltip-whatlinkshere-invert' )->text() ]
494  );
495 
496  $f .= ' ';
497 
498  # Submit
499  $f .= Xml::submitButton( $this->msg( 'whatlinkshere-submit' )->text() );
500 
501  # Close
502  $f .= Xml::closeElement( 'fieldset' ) . Xml::closeElement( 'form' ) . "\n";
503 
504  return $f;
505  }
506 
512  function getFilterPanel() {
513  $show = $this->msg( 'show' )->escaped();
514  $hide = $this->msg( 'hide' )->escaped();
515 
516  $changed = $this->opts->getChangedValues();
517  unset( $changed['target'] ); // Already in the request title
518 
519  $links = [];
520  $types = [ 'hidetrans', 'hidelinks', 'hideredirs' ];
521  if ( $this->target->getNamespace() == NS_FILE ) {
522  $types[] = 'hideimages';
523  }
524 
525  // Combined message keys: 'whatlinkshere-hideredirs', 'whatlinkshere-hidetrans',
526  // 'whatlinkshere-hidelinks', 'whatlinkshere-hideimages'
527  // To be sure they will be found by grep
528  foreach ( $types as $type ) {
529  $chosen = $this->opts->getValue( $type );
530  $msg = $chosen ? $show : $hide;
531  $overrides = [ $type => !$chosen ];
532  $links[] = $this->msg( "whatlinkshere-{$type}" )->rawParams(
533  $this->makeSelfLink( $msg, array_merge( $changed, $overrides ) ) )->escaped();
534  }
535 
536  return Xml::fieldset(
537  $this->msg( 'whatlinkshere-filters' )->text(),
538  $this->getLanguage()->pipeList( $links )
539  );
540  }
541 
550  public function prefixSearchSubpages( $search, $limit, $offset ) {
551  return $this->prefixSearchString( $search, $limit, $offset );
552  }
553 
554  protected function getGroupName() {
555  return 'pagetools';
556  }
557 }
wlhLink(Title $target, $text, $editText)
Helper class to keep track of options when mixing links and form elements.
Definition: FormOptions.php:35
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:762
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1418
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known', 'noclasses'])
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
wfScript($script= 'index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
setValue($name, $value, $force=false)
Use to set the value of an option.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
const INTNULL
Integer type or null, maps to WebRequest::getIntOrNull() This is useful for the namespace selector...
Definition: FormOptions.php:54
getPrevNext($prevId, $nextId)
if(!isset($args[0])) $lang
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:759
$value
getFilterPanel()
Create filter panel.
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:381
msg()
Wrapper around wfMessage that sets the current context.
including($x=null)
Whether the special page is being evaluated via transclusion.
getOutput()
Get the OutputPage being used for this instance.
getPrefixedText()
Get the prefixed title with spaces.
Definition: Title.php:1449
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:277
Represents a title within MediaWiki.
Definition: Title.php:34
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:460
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
fetchValuesFromRequest(WebRequest $r, $optionKeys=null)
Fetch values for all options (or selected options) from the given WebRequest, making them available f...
the value to return A Title object or null for latest to be modified or replaced by the hook handler or if authentication is not possible after cache objects are set for highlighting & $link
Definition: hooks.txt:2581
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:31
static fieldset($legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:578
static closeElement($element)
Shortcut to close an XML element.
Definition: Xml.php:118
Shortcut to construct an includable special page.
getDBkey()
Get the main part with underscores.
Definition: Title.php:911
static wrapClass($text, $class, $tag= 'span', $attribs=[])
Shortcut to make a specific element with a class attribute.
Definition: Xml.php:263
selectSQLText($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
The equivalent of IDatabase::select() except that the constructed SQL is returned, instead of being immediately executed.
getValue($name)
Get the value for the given option name.
static openElement($element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
getSkin()
Shortcut to get the skin being used for this instance.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
const DB_SLAVE
Definition: Defines.php:46
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:912
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
getNamespace()
Get the namespace index, i.e.
Definition: Title.php:934
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
const NS_FILE
Definition: Defines.php:75
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
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
add($name, $default, $type=self::AUTO)
Add an option to be handled by this FormOptions instance.
Definition: FormOptions.php:78
validateIntBounds($name, $min, $max)
$from
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
static tags($element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
getUser()
Shortcut to get the User executing this instance.
getConfig()
Shortcut to get main config object.
showIndirectLinks($level, $target, $limit, $from=0, $back=0)
getLanguage()
Shortcut to get user's language.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
Definition: hooks.txt:1004
static checkLabel($label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:420
addQuotes($s)
Adds quotes and backslashes.
getRequest()
Get the WebRequest being used for this instance.
select($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
Execute a SELECT query constructed using the various parameters provided.
prefixSearchString($search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2338
static & makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:524
Implements Special:Whatlinkshere.
listItem($row, $nt, $target, $notClose=false)
Basic database interface for live and lazy-loaded DB handles.
Definition: IDatabase.php:35
prefixSearchSubpages($search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
getPageTitle($subpage=false)
Get a self-referential title object.
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
Definition: Html.php:847
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:310