MediaWiki  master
SpecialContributions.php
Go to the documentation of this file.
1 <?php
26 
33  protected $opts;
34 
35  public function __construct() {
36  parent::__construct( 'Contributions' );
37  }
38 
39  public function execute( $par ) {
40  $this->setHeaders();
41  $this->outputHeader();
42  $out = $this->getOutput();
43  // Modules required for viewing the list of contributions (also when included on other pages)
44  $out->addModuleStyles( [
45  'jquery.makeCollapsible.styles',
46  'mediawiki.interface.helpers.styles',
47  'mediawiki.special',
48  'mediawiki.special.changeslist',
49  ] );
50  $out->addModules( [
51  'mediawiki.special.recentchanges',
52  // Certain skins e.g. Minerva might have disabled this module.
53  'mediawiki.page.ready'
54  ] );
55  $this->addHelpLink( 'Help:User contributions' );
56 
57  $this->opts = [];
58  $request = $this->getRequest();
59 
60  $target = $par ?? $request->getVal( 'target' );
61 
62  $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
63 
64  if ( !strlen( $target ) ) {
65  if ( !$this->including() ) {
66  $out->addHTML( $this->getForm( $this->opts ) );
67  }
68 
69  return;
70  }
71 
72  $user = $this->getUser();
73 
74  $this->opts['limit'] = $request->getInt( 'limit', $user->getOption( 'rclimit' ) );
75  $this->opts['target'] = $target;
76  $this->opts['topOnly'] = $request->getBool( 'topOnly' );
77  $this->opts['newOnly'] = $request->getBool( 'newOnly' );
78  $this->opts['hideMinor'] = $request->getBool( 'hideMinor' );
79 
80  $id = 0;
81  if ( ExternalUserNames::isExternal( $target ) ) {
82  $userObj = User::newFromName( $target, false );
83  if ( !$userObj ) {
84  $out->addHTML( $this->getForm( $this->opts ) );
85  return;
86  }
87 
88  $out->addSubtitle( $this->contributionsSub( $userObj ) );
89  $out->setHTMLTitle( $this->msg(
90  'pagetitle',
91  $this->msg( 'contributions-title', $target )->plain()
92  )->inContentLanguage() );
93  } else {
94  $nt = Title::makeTitleSafe( NS_USER, $target );
95  if ( !$nt ) {
96  $out->addHTML( $this->getForm( $this->opts ) );
97  return;
98  }
99  $userObj = User::newFromName( $nt->getText(), false );
100  if ( !$userObj ) {
101  $out->addHTML( $this->getForm( $this->opts ) );
102  return;
103  }
104  $id = $userObj->getId();
105 
106  $target = $nt->getText();
107  $out->addSubtitle( $this->contributionsSub( $userObj ) );
108  $out->setHTMLTitle( $this->msg(
109  'pagetitle',
110  $this->msg( 'contributions-title', $target )->plain()
111  )->inContentLanguage() );
112 
113  # For IP ranges, we want the contributionsSub, but not the skin-dependent
114  # links under 'Tools', which may include irrelevant links like 'Logs'.
115  if ( !IP::isValidRange( $target ) ) {
116  $this->getSkin()->setRelevantUser( $userObj );
117  }
118  }
119 
120  $ns = $request->getVal( 'namespace', null );
121  if ( $ns !== null && $ns !== '' && $ns !== 'all' ) {
122  $this->opts['namespace'] = intval( $ns );
123  } else {
124  $this->opts['namespace'] = '';
125  }
126 
127  // Backwards compatibility: Before using OOUI form the old HTML form had
128  // fields for nsInvert and associated. These have now been replaced with the
129  // wpFilters query string parameters. These are retained to keep old URIs working.
130  $this->opts['associated'] = $request->getBool( 'associated' );
131  $this->opts['nsInvert'] = (bool)$request->getVal( 'nsInvert' );
132  $nsFilters = $request->getArray( 'wpfilters', null );
133  if ( $nsFilters !== null ) {
134  $this->opts['associated'] = in_array( 'associated', $nsFilters );
135  $this->opts['nsInvert'] = in_array( 'nsInvert', $nsFilters );
136  }
137 
138  $this->opts['tagfilter'] = (string)$request->getVal( 'tagfilter' );
139 
140  // Allows reverts to have the bot flag in recent changes. It is just here to
141  // be passed in the form at the top of the page
142  if ( MediaWikiServices::getInstance()
144  ->userHasRight( $user, 'markbotedits' ) && $request->getBool( 'bot' )
145  ) {
146  $this->opts['bot'] = '1';
147  }
148 
149  $skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
150  # Offset overrides year/month selection
151  if ( !$skip ) {
152  $this->opts['year'] = $request->getVal( 'year' );
153  $this->opts['month'] = $request->getVal( 'month' );
154 
155  $this->opts['start'] = $request->getVal( 'start' );
156  $this->opts['end'] = $request->getVal( 'end' );
157  }
158  $this->opts = ContribsPager::processDateFilter( $this->opts );
159 
160  if ( $this->opts['namespace'] < NS_MAIN ) {
161  $this->getOutput()->wrapWikiMsg(
162  "<div class=\"mw-negative-namespace-not-supported error\">\n\$1\n</div>",
163  [ 'negative-namespace-not-supported' ]
164  );
165  $out->addHTML( $this->getForm( $this->opts ) );
166  return;
167  }
168 
169  $feedType = $request->getVal( 'feed' );
170 
171  $feedParams = [
172  'action' => 'feedcontributions',
173  'user' => $target,
174  ];
175  if ( $this->opts['topOnly'] ) {
176  $feedParams['toponly'] = true;
177  }
178  if ( $this->opts['newOnly'] ) {
179  $feedParams['newonly'] = true;
180  }
181  if ( $this->opts['hideMinor'] ) {
182  $feedParams['hideminor'] = true;
183  }
184  if ( $this->opts['deletedOnly'] ) {
185  $feedParams['deletedonly'] = true;
186  }
187  if ( $this->opts['tagfilter'] !== '' ) {
188  $feedParams['tagfilter'] = $this->opts['tagfilter'];
189  }
190  if ( $this->opts['namespace'] !== '' ) {
191  $feedParams['namespace'] = $this->opts['namespace'];
192  }
193  // Don't use year and month for the feed URL, but pass them on if
194  // we redirect to API (if $feedType is specified)
195  if ( $feedType && $this->opts['year'] !== null ) {
196  $feedParams['year'] = $this->opts['year'];
197  }
198  if ( $feedType && $this->opts['month'] !== null ) {
199  $feedParams['month'] = $this->opts['month'];
200  }
201 
202  if ( $feedType ) {
203  // Maintain some level of backwards compatibility
204  // If people request feeds using the old parameters, redirect to API
205  $feedParams['feedformat'] = $feedType;
206  $url = wfAppendQuery( wfScript( 'api' ), $feedParams );
207 
208  $out->redirect( $url, '301' );
209 
210  return;
211  }
212 
213  // Add RSS/atom links
214  $this->addFeedLinks( $feedParams );
215 
216  if ( Hooks::run( 'SpecialContributionsBeforeMainOutput', [ $id, $userObj, $this ] ) ) {
217  $pager = new ContribsPager( $this->getContext(), [
218  'target' => $target,
219  'namespace' => $this->opts['namespace'],
220  'tagfilter' => $this->opts['tagfilter'],
221  'start' => $this->opts['start'],
222  'end' => $this->opts['end'],
223  'deletedOnly' => $this->opts['deletedOnly'],
224  'topOnly' => $this->opts['topOnly'],
225  'newOnly' => $this->opts['newOnly'],
226  'hideMinor' => $this->opts['hideMinor'],
227  'nsInvert' => $this->opts['nsInvert'],
228  'associated' => $this->opts['associated'],
229  ], $this->getLinkRenderer() );
230  if ( !$this->including() ) {
231  $out->addHTML( $this->getForm( $this->opts ) );
232  }
233 
234  if ( IP::isValidRange( $target ) && !$pager->isQueryableRange( $target ) ) {
235  // Valid range, but outside CIDR limit.
236  $limits = $this->getConfig()->get( 'RangeContributionsCIDRLimit' );
237  $limit = $limits[ IP::isIPv4( $target ) ? 'IPv4' : 'IPv6' ];
238  $out->addWikiMsg( 'sp-contributions-outofrange', $limit );
239  } elseif ( !$pager->getNumRows() ) {
240  $out->addWikiMsg( 'nocontribs', $target );
241  } else {
242  # Show a message about replica DB lag, if applicable
243  $lag = $pager->getDatabase()->getSessionLagStatus()['lag'];
244  if ( $lag > 0 ) {
245  $out->showLagWarning( $lag );
246  }
247 
248  $output = $pager->getBody();
249  if ( !$this->including() ) {
250  $output = $pager->getNavigationBar() .
251  $output .
252  $pager->getNavigationBar();
253  }
254  $out->addHTML( $output );
255  }
256 
257  $out->preventClickjacking( $pager->getPreventClickjacking() );
258 
259  # Show the appropriate "footer" message - WHOIS tools, etc.
260  if ( IP::isValidRange( $target ) ) {
261  $message = 'sp-contributions-footer-anon-range';
262  } elseif ( IP::isIPAddress( $target ) ) {
263  $message = 'sp-contributions-footer-anon';
264  } elseif ( $userObj->isAnon() ) {
265  // No message for non-existing users
266  $message = '';
267  } else {
268  $message = 'sp-contributions-footer';
269  }
270 
271  if ( $message && !$this->including() && !$this->msg( $message, $target )->isDisabled() ) {
272  $out->wrapWikiMsg(
273  "<div class='mw-contributions-footer'>\n$1\n</div>",
274  [ $message, $target ] );
275  }
276  }
277  }
278 
286  protected function contributionsSub( $userObj ) {
287  if ( $userObj->isAnon() ) {
288  // Show a warning message that the user being searched for doesn't exist.
289  // User::isIP returns true for IP address and usemod IPs like '123.123.123.xxx',
290  // but returns false for IP ranges. We don't want to suggest either of these are
291  // valid usernames which we would with the 'contributions-userdoesnotexist' message.
292  if ( !User::isIP( $userObj->getName() ) && !$userObj->isIPRange() ) {
293  $this->getOutput()->wrapWikiMsg(
294  "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
295  [
296  'contributions-userdoesnotexist',
297  wfEscapeWikiText( $userObj->getName() ),
298  ]
299  );
300  if ( !$this->including() ) {
301  $this->getOutput()->setStatusCode( 404 );
302  }
303  }
304  $user = htmlspecialchars( $userObj->getName() );
305  } else {
306  $user = $this->getLinkRenderer()->makeLink( $userObj->getUserPage(), $userObj->getName() );
307  }
308  $nt = $userObj->getUserPage();
309  $talk = $userObj->getTalkPage();
310  $links = '';
311  if ( $talk ) {
312  $tools = self::getUserLinks( $this, $userObj );
313  $links = Html::openElement( 'span', [ 'class' => 'mw-changeslist-links' ] );
314  foreach ( $tools as $tool ) {
315  $links .= Html::rawElement( 'span', [], $tool ) . ' ';
316  }
317  $links = trim( $links ) . Html::closeElement( 'span' );
318 
319  // Show a note if the user is blocked and display the last block log entry.
320  // Do not expose the autoblocks, since that may lead to a leak of accounts' IPs,
321  // and also this will display a totally irrelevant log entry as a current block.
322  if ( !$this->including() ) {
323  // For IP ranges you must give DatabaseBlock::newFromTarget the CIDR string
324  // and not a user object.
325  if ( $userObj->isIPRange() ) {
326  $block = DatabaseBlock::newFromTarget( $userObj->getName(), $userObj->getName() );
327  } else {
328  $block = DatabaseBlock::newFromTarget( $userObj, $userObj );
329  }
330 
331  if ( !is_null( $block ) && $block->getType() != DatabaseBlock::TYPE_AUTO ) {
332  if ( $block->getType() == DatabaseBlock::TYPE_RANGE ) {
333  $nt = MediaWikiServices::getInstance()->getNamespaceInfo()->
334  getCanonicalName( NS_USER ) . ':' . $block->getTarget();
335  }
336 
337  $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
339  $out,
340  'block',
341  $nt,
342  '',
343  [
344  'lim' => 1,
345  'showIfEmpty' => false,
346  'msgKey' => [
347  $userObj->isAnon() ?
348  'sp-contributions-blocked-notice-anon' :
349  'sp-contributions-blocked-notice',
350  $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
351  ],
352  'offset' => '' # don't use WebRequest parameter offset
353  ]
354  );
355  }
356  }
357  }
358 
359  return Html::rawElement( 'div', [ 'class' => 'mw-contributions-user-tools' ],
360  $this->msg( 'contributions-subtitle' )->rawParams( $user )->params( $userObj->getName() )
361  . ' ' . $links
362  );
363  }
364 
373  public static function getUserLinks( SpecialPage $sp, User $target ) {
374  $id = $target->getId();
375  $username = $target->getName();
376  $userpage = $target->getUserPage();
377  $talkpage = $target->getTalkPage();
378  $isIP = IP::isValid( $username );
379  $isRange = IP::isValidRange( $username );
380 
381  $linkRenderer = $sp->getLinkRenderer();
382 
383  $tools = [];
384  # No talk pages for IP ranges.
385  if ( !$isRange ) {
386  $tools['user-talk'] = $linkRenderer->makeLink(
387  $talkpage,
388  $sp->msg( 'sp-contributions-talk' )->text()
389  );
390  }
391 
392  # Block / Change block / Unblock links
393  $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
394  if ( $permissionManager->userHasRight( $sp->getUser(), 'block' ) ) {
395  if ( $target->getBlock() && $target->getBlock()->getType() != DatabaseBlock::TYPE_AUTO ) {
396  $tools['block'] = $linkRenderer->makeKnownLink( # Change block link
397  SpecialPage::getTitleFor( 'Block', $username ),
398  $sp->msg( 'change-blocklink' )->text()
399  );
400  $tools['unblock'] = $linkRenderer->makeKnownLink( # Unblock link
401  SpecialPage::getTitleFor( 'Unblock', $username ),
402  $sp->msg( 'unblocklink' )->text()
403  );
404  } else { # User is not blocked
405  $tools['block'] = $linkRenderer->makeKnownLink( # Block link
406  SpecialPage::getTitleFor( 'Block', $username ),
407  $sp->msg( 'blocklink' )->text()
408  );
409  }
410  }
411 
412  # Block log link
413  $tools['log-block'] = $linkRenderer->makeKnownLink(
414  SpecialPage::getTitleFor( 'Log', 'block' ),
415  $sp->msg( 'sp-contributions-blocklog' )->text(),
416  [],
417  [ 'page' => $userpage->getPrefixedText() ]
418  );
419 
420  # Suppression log link (T61120)
421  if ( $permissionManager->userHasRight( $sp->getUser(), 'suppressionlog' ) ) {
422  $tools['log-suppression'] = $linkRenderer->makeKnownLink(
423  SpecialPage::getTitleFor( 'Log', 'suppress' ),
424  $sp->msg( 'sp-contributions-suppresslog', $username )->text(),
425  [],
426  [ 'offender' => $username ]
427  );
428  }
429 
430  # Don't show some links for IP ranges
431  if ( !$isRange ) {
432  # Uploads: hide if IPs cannot upload (T220674)
433  if ( !$isIP || $permissionManager->userHasRight( $target, 'upload' ) ) {
434  $tools['uploads'] = $linkRenderer->makeKnownLink(
435  SpecialPage::getTitleFor( 'Listfiles', $username ),
436  $sp->msg( 'sp-contributions-uploads' )->text()
437  );
438  }
439 
440  # Other logs link
441  # Todo: T146628
442  $tools['logs'] = $linkRenderer->makeKnownLink(
443  SpecialPage::getTitleFor( 'Log', $username ),
444  $sp->msg( 'sp-contributions-logs' )->text()
445  );
446 
447  # Add link to deleted user contributions for priviledged users
448  # Todo: T183457
449  if ( $permissionManager->userHasRight( $sp->getUser(), 'deletedhistory' ) ) {
450  $tools['deletedcontribs'] = $linkRenderer->makeKnownLink(
451  SpecialPage::getTitleFor( 'DeletedContributions', $username ),
452  $sp->msg( 'sp-contributions-deleted', $username )->text()
453  );
454  }
455  }
456 
457  # Add a link to change user rights for privileged users
458  $userrightsPage = new UserrightsPage();
459  $userrightsPage->setContext( $sp->getContext() );
460  if ( $userrightsPage->userCanChangeRights( $target ) ) {
461  $tools['userrights'] = $linkRenderer->makeKnownLink(
462  SpecialPage::getTitleFor( 'Userrights', $username ),
463  $sp->msg( 'sp-contributions-userrights', $username )->text()
464  );
465  }
466 
467  Hooks::run( 'ContributionsToolLinks', [ $id, $userpage, &$tools, $sp ] );
468 
469  return $tools;
470  }
471 
478  protected function getForm( array $pagerOptions ) {
479  $this->opts['title'] = $this->getPageTitle()->getPrefixedText();
480  // Modules required only for the form
481  $this->getOutput()->addModules( [
482  'mediawiki.special.contributions',
483  ] );
484  $this->getOutput()->addModuleStyles( 'mediawiki.widgets.DateInputWidget.styles' );
485  $this->getOutput()->enableOOUI();
486  $fields = [];
487 
488  # Add hidden params for tracking except for parameters in $skipParameters
489  $skipParameters = [
490  'namespace',
491  'nsInvert',
492  'deletedOnly',
493  'target',
494  'year',
495  'month',
496  'start',
497  'end',
498  'topOnly',
499  'newOnly',
500  'hideMinor',
501  'associated',
502  'tagfilter'
503  ];
504 
505  foreach ( $this->opts as $name => $value ) {
506  if ( in_array( $name, $skipParameters ) ) {
507  continue;
508  }
509 
510  $fields[$name] = [
511  'name' => $name,
512  'type' => 'hidden',
513  'default' => $value,
514  ];
515  }
516 
517  $target = $this->opts['target'] ?? null;
518  $fields['target'] = [
519  'type' => 'user',
520  'default' => $target ?
521  str_replace( '_', ' ', $target ) : '' ,
522  'label' => $this->msg( 'sp-contributions-username' )->text(),
523  'name' => 'target',
524  'id' => 'mw-target-user-or-ip',
525  'size' => 40,
526  'autofocus' => !$target,
527  'section' => 'contribs-top',
528  ];
529 
530  $ns = $this->opts['namespace'] ?? null;
531  $fields['namespace'] = [
532  'type' => 'namespaceselect',
533  'label' => $this->msg( 'namespace' )->text(),
534  'name' => 'namespace',
535  'cssclass' => 'namespaceselector',
536  'default' => $ns,
537  'id' => 'namespace',
538  'section' => 'contribs-top',
539  ];
540  $request = $this->getRequest();
541  $nsFilters = $request->getArray( 'wpfilters' );
542  $fields['nsFilters'] = [
543  'class' => 'HTMLMultiSelectField',
544  'label' => '',
545  'name' => 'wpfilters',
546  'flatlist' => true,
547  // Only shown when namespaces are selected.
548  'cssclass' => $ns === '' ?
549  'contribs-ns-filters mw-input-with-label mw-input-hidden' :
550  'contribs-ns-filters mw-input-with-label',
551  // `contribs-ns-filters` class allows these fields to be toggled on/off by JavaScript.
552  // See resources/src/mediawiki.special.recentchanges.js
553  'infusable' => true,
554  'options' => [
555  $this->msg( 'invert' )->text() => 'nsInvert',
556  $this->msg( 'namespace_association' )->text() => 'associated',
557  ],
558  'default' => $nsFilters,
559  'section' => 'contribs-top',
560  ];
561  $fields['tagfilter'] = [
562  'type' => 'tagfilter',
563  'cssclass' => 'mw-tagfilter-input',
564  'id' => 'tagfilter',
565  'label-message' => [ 'tag-filter', 'parse' ],
566  'name' => 'tagfilter',
567  'size' => 20,
568  'section' => 'contribs-top',
569  ];
570 
571  if ( MediaWikiServices::getInstance()
573  ->userHasRight( $this->getUser(), 'deletedhistory' )
574  ) {
575  $fields['deletedOnly'] = [
576  'type' => 'check',
577  'id' => 'mw-show-deleted-only',
578  'label' => $this->msg( 'history-show-deleted' )->text(),
579  'name' => 'deletedOnly',
580  'section' => 'contribs-top',
581  ];
582  }
583 
584  $fields['topOnly'] = [
585  'type' => 'check',
586  'id' => 'mw-show-top-only',
587  'label' => $this->msg( 'sp-contributions-toponly' )->text(),
588  'name' => 'topOnly',
589  'section' => 'contribs-top',
590  ];
591  $fields['newOnly'] = [
592  'type' => 'check',
593  'id' => 'mw-show-new-only',
594  'label' => $this->msg( 'sp-contributions-newonly' )->text(),
595  'name' => 'newOnly',
596  'section' => 'contribs-top',
597  ];
598  $fields['hideMinor'] = [
599  'type' => 'check',
600  'cssclass' => 'mw-hide-minor-edits',
601  'id' => 'mw-show-new-only',
602  'label' => $this->msg( 'sp-contributions-hideminor' )->text(),
603  'name' => 'hideMinor',
604  'section' => 'contribs-top',
605  ];
606 
607  // Allow additions at this point to the filters.
608  $rawFilters = [];
609  Hooks::run(
610  'SpecialContributions::getForm::filters',
611  [ $this, &$rawFilters ]
612  );
613  foreach ( $rawFilters as $filter ) {
614  // Backwards compatibility support for previous hook function signature.
615  if ( is_string( $filter ) ) {
616  $fields[] = [
617  'type' => 'info',
618  'default' => $filter,
619  'raw' => true,
620  'section' => 'contribs-top',
621  ];
622  wfDeprecated(
623  __METHOD__ .
624  ' returning string[]',
625  '1.33'
626  );
627  } else {
628  // Preferred append method.
629  $fields[] = $filter;
630  }
631  }
632 
633  $fields['start'] = [
634  'type' => 'date',
635  'default' => '',
636  'id' => 'mw-date-start',
637  'label' => $this->msg( 'date-range-from' )->text(),
638  'name' => 'start',
639  'section' => 'contribs-date',
640  ];
641  $fields['end'] = [
642  'type' => 'date',
643  'default' => '',
644  'id' => 'mw-date-end',
645  'label' => $this->msg( 'date-range-to' )->text(),
646  'name' => 'end',
647  'section' => 'contribs-date',
648  ];
649 
650  $htmlForm = HTMLForm::factory( 'ooui', $fields, $this->getContext() );
651  $htmlForm
652  ->setMethod( 'get' )
653  // When offset is defined, the user is paging through results
654  // so we hide the form by default to allow users to focus on browsing
655  // rather than defining search parameters
656  ->setCollapsibleOptions(
657  ( $pagerOptions['target'] ?? null ) ||
658  ( $pagerOptions['start'] ?? null ) ||
659  ( $pagerOptions['end'] ?? null )
660  )
661  ->setAction( wfScript() )
662  ->setSubmitText( $this->msg( 'sp-contributions-submit' )->text() )
663  ->setWrapperLegend( $this->msg( 'sp-contributions-search' )->text() );
664 
665  $explain = $this->msg( 'sp-contributions-explain' );
666  if ( !$explain->isBlank() ) {
667  $htmlForm->addFooterText( "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>" );
668  }
669 
670  $htmlForm->loadData();
671 
672  return $htmlForm->getHTML( false );
673  }
674 
683  public function prefixSearchSubpages( $search, $limit, $offset ) {
684  $user = User::newFromName( $search );
685  if ( !$user ) {
686  // No prefix suggestion for invalid user
687  return [];
688  }
689  // Autocomplete subpage as user list - public to allow caching
690  return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
691  }
692 
693  protected function getGroupName() {
694  return 'users';
695  }
696 }
static isValidRange( $ipRange)
Validate an IP range (valid address with a valid CIDR prefix).
Definition: IP.php:125
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
Definition: IP.php:77
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
static processDateFilter(array $opts)
Set up date filter options, given request data.
getContext()
Gets the context this SpecialPage is executed in.
const NS_MAIN
Definition: Defines.php:60
including( $x=null)
Whether the special page is being evaluated via transclusion.
static isIP( $name)
Does the string match an anonymous IP address?
Definition: User.php:891
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing &#39;/&#39;...
Definition: Html.php:251
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getOutput()
Get the OutputPage being used for this instance.
static search( $audience, $search, $limit, $offset=0)
Do a prefix search of user names and return a list of matching user names.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
getPermissionManager()
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static factory( $displayFormat,... $arguments)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:307
Shortcut to construct an includable special page.
Special:Contributions, show user contributions in a paged list.
contributionsSub( $userObj)
Generates the subheading with links.
getSkin()
Shortcut to get the skin being used for this instance.
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:315
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
$filter
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don&#39;t need a full Title object...
Definition: SpecialPage.php:83
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:612
addFeedLinks( $params)
Adds RSS/atom links.
getUser()
Shortcut to get the User executing this instance.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
getConfig()
Shortcut to get main config object.
static isIPv4( $ip)
Given a string, determine if it as valid IP in IPv4 only.
Definition: IP.php:99
getForm(array $pagerOptions)
Generates the namespace selector form with hidden attributes.
Special page to allow managing user group membership.
getRequest()
Get the WebRequest being used for this instance.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:515
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
getPageTitle( $subpage=false)
Get a self-referential title object.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
static isExternal( $username)
Tells whether the username is external or not.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
MediaWiki Linker LinkRenderer null $linkRenderer
Definition: SpecialPage.php:67