MediaWiki  1.27.1
SpecialContributions.php
Go to the documentation of this file.
1 <?php
30  protected $opts;
31 
32  public function __construct() {
33  parent::__construct( 'Contributions' );
34  }
35 
36  public function execute( $par ) {
37  $this->setHeaders();
38  $this->outputHeader();
39  $out = $this->getOutput();
40  $out->addModuleStyles( 'mediawiki.special' );
41  $this->addHelpLink( 'Help:User contributions' );
42 
43  $this->opts = [];
44  $request = $this->getRequest();
45 
46  if ( $par !== null ) {
47  $target = $par;
48  } else {
49  $target = $request->getVal( 'target' );
50  }
51 
52  if ( $request->getVal( 'contribs' ) == 'newbie' || $par === 'newbies' ) {
53  $target = 'newbies';
54  $this->opts['contribs'] = 'newbie';
55  } else {
56  $this->opts['contribs'] = 'user';
57  }
58 
59  $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
60 
61  if ( !strlen( $target ) ) {
62  if ( !$this->including() ) {
63  $out->addHTML( $this->getForm() );
64  }
65 
66  return;
67  }
68 
69  $user = $this->getUser();
70 
71  $this->opts['limit'] = $request->getInt( 'limit', $user->getOption( 'rclimit' ) );
72  $this->opts['target'] = $target;
73  $this->opts['topOnly'] = $request->getBool( 'topOnly' );
74  $this->opts['newOnly'] = $request->getBool( 'newOnly' );
75 
76  $nt = Title::makeTitleSafe( NS_USER, $target );
77  if ( !$nt ) {
78  $out->addHTML( $this->getForm() );
79 
80  return;
81  }
82  $userObj = User::newFromName( $nt->getText(), false );
83  if ( !$userObj ) {
84  $out->addHTML( $this->getForm() );
85 
86  return;
87  }
88  $id = $userObj->getId();
89 
90  if ( $this->opts['contribs'] != 'newbie' ) {
91  $target = $nt->getText();
92  $out->addSubtitle( $this->contributionsSub( $userObj ) );
93  $out->setHTMLTitle( $this->msg(
94  'pagetitle',
95  $this->msg( 'contributions-title', $target )->plain()
96  )->inContentLanguage() );
97  $this->getSkin()->setRelevantUser( $userObj );
98  } else {
99  $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
100  $out->setHTMLTitle( $this->msg(
101  'pagetitle',
102  $this->msg( 'sp-contributions-newbies-title' )->plain()
103  )->inContentLanguage() );
104  }
105 
106  $ns = $request->getVal( 'namespace', null );
107  if ( $ns !== null && $ns !== '' ) {
108  $this->opts['namespace'] = intval( $ns );
109  } else {
110  $this->opts['namespace'] = '';
111  }
112 
113  $this->opts['associated'] = $request->getBool( 'associated' );
114  $this->opts['nsInvert'] = (bool)$request->getVal( 'nsInvert' );
115  $this->opts['tagfilter'] = (string)$request->getVal( 'tagfilter' );
116 
117  // Allows reverts to have the bot flag in recent changes. It is just here to
118  // be passed in the form at the top of the page
119  if ( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
120  $this->opts['bot'] = '1';
121  }
122 
123  $skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
124  # Offset overrides year/month selection
125  if ( $skip ) {
126  $this->opts['year'] = '';
127  $this->opts['month'] = '';
128  } else {
129  $this->opts['year'] = $request->getIntOrNull( 'year' );
130  $this->opts['month'] = $request->getIntOrNull( 'month' );
131  }
132 
133  $feedType = $request->getVal( 'feed' );
134 
135  $feedParams = [
136  'action' => 'feedcontributions',
137  'user' => $target,
138  ];
139  if ( $this->opts['topOnly'] ) {
140  $feedParams['toponly'] = true;
141  }
142  if ( $this->opts['newOnly'] ) {
143  $feedParams['newonly'] = true;
144  }
145  if ( $this->opts['deletedOnly'] ) {
146  $feedParams['deletedonly'] = true;
147  }
148  if ( $this->opts['tagfilter'] !== '' ) {
149  $feedParams['tagfilter'] = $this->opts['tagfilter'];
150  }
151  if ( $this->opts['namespace'] !== '' ) {
152  $feedParams['namespace'] = $this->opts['namespace'];
153  }
154  // Don't use year and month for the feed URL, but pass them on if
155  // we redirect to API (if $feedType is specified)
156  if ( $feedType && $this->opts['year'] !== null ) {
157  $feedParams['year'] = $this->opts['year'];
158  }
159  if ( $feedType && $this->opts['month'] !== null ) {
160  $feedParams['month'] = $this->opts['month'];
161  }
162 
163  if ( $feedType ) {
164  // Maintain some level of backwards compatibility
165  // If people request feeds using the old parameters, redirect to API
166  $feedParams['feedformat'] = $feedType;
167  $url = wfAppendQuery( wfScript( 'api' ), $feedParams );
168 
169  $out->redirect( $url, '301' );
170 
171  return;
172  }
173 
174  // Add RSS/atom links
175  $this->addFeedLinks( $feedParams );
176 
177  if ( Hooks::run( 'SpecialContributionsBeforeMainOutput', [ $id, $userObj, $this ] ) ) {
178  if ( !$this->including() ) {
179  $out->addHTML( $this->getForm() );
180  }
181  $pager = new ContribsPager( $this->getContext(), [
182  'target' => $target,
183  'contribs' => $this->opts['contribs'],
184  'namespace' => $this->opts['namespace'],
185  'tagfilter' => $this->opts['tagfilter'],
186  'year' => $this->opts['year'],
187  'month' => $this->opts['month'],
188  'deletedOnly' => $this->opts['deletedOnly'],
189  'topOnly' => $this->opts['topOnly'],
190  'newOnly' => $this->opts['newOnly'],
191  'nsInvert' => $this->opts['nsInvert'],
192  'associated' => $this->opts['associated'],
193  ] );
194 
195  if ( !$pager->getNumRows() ) {
196  $out->addWikiMsg( 'nocontribs', $target );
197  } else {
198  # Show a message about slave lag, if applicable
199  $lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
200  if ( $lag > 0 ) {
201  $out->showLagWarning( $lag );
202  }
203 
204  $output = $pager->getBody();
205  if ( !$this->including() ) {
206  $output = '<p>' . $pager->getNavigationBar() . '</p>' .
207  $output .
208  '<p>' . $pager->getNavigationBar() . '</p>';
209  }
210  $out->addHTML( $output );
211  }
212  $out->preventClickjacking( $pager->getPreventClickjacking() );
213 
214  # Show the appropriate "footer" message - WHOIS tools, etc.
215  if ( $this->opts['contribs'] == 'newbie' ) {
216  $message = 'sp-contributions-footer-newbies';
217  } elseif ( IP::isIPAddress( $target ) ) {
218  $message = 'sp-contributions-footer-anon';
219  } elseif ( $userObj->isAnon() ) {
220  // No message for non-existing users
221  $message = '';
222  } else {
223  $message = 'sp-contributions-footer';
224  }
225 
226  if ( $message ) {
227  if ( !$this->including() ) {
228  if ( !$this->msg( $message, $target )->isDisabled() ) {
229  $out->wrapWikiMsg(
230  "<div class='mw-contributions-footer'>\n$1\n</div>",
231  [ $message, $target ] );
232  }
233  }
234  }
235  }
236  }
237 
245  protected function contributionsSub( $userObj ) {
246  if ( $userObj->isAnon() ) {
247  // Show a warning message that the user being searched for doesn't exists
248  if ( !User::isIP( $userObj->getName() ) ) {
249  $this->getOutput()->wrapWikiMsg(
250  "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
251  [
252  'contributions-userdoesnotexist',
253  wfEscapeWikiText( $userObj->getName() ),
254  ]
255  );
256  if ( !$this->including() ) {
257  $this->getOutput()->setStatusCode( 404 );
258  }
259  }
260  $user = htmlspecialchars( $userObj->getName() );
261  } else {
262  $user = Linker::link( $userObj->getUserPage(), htmlspecialchars( $userObj->getName() ) );
263  }
264  $nt = $userObj->getUserPage();
265  $talk = $userObj->getTalkPage();
266  $links = '';
267  if ( $talk ) {
268  $tools = $this->getUserLinks( $nt, $talk, $userObj );
269  $links = $this->getLanguage()->pipeList( $tools );
270 
271  // Show a note if the user is blocked and display the last block log entry.
272  // Do not expose the autoblocks, since that may lead to a leak of accounts' IPs,
273  // and also this will display a totally irrelevant log entry as a current block.
274  if ( !$this->including() ) {
275  $block = Block::newFromTarget( $userObj, $userObj );
276  if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
277  if ( $block->getType() == Block::TYPE_RANGE ) {
278  $nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
279  }
280 
281  $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
283  $out,
284  'block',
285  $nt,
286  '',
287  [
288  'lim' => 1,
289  'showIfEmpty' => false,
290  'msgKey' => [
291  $userObj->isAnon() ?
292  'sp-contributions-blocked-notice-anon' :
293  'sp-contributions-blocked-notice',
294  $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
295  ],
296  'offset' => '' # don't use WebRequest parameter offset
297  ]
298  );
299  }
300  }
301  }
302 
303  return $this->msg( 'contribsub2' )->rawParams( $user, $links )->params( $userObj->getName() );
304  }
305 
313  public function getUserLinks( Title $userpage, Title $talkpage, User $target ) {
314 
315  $id = $target->getId();
316  $username = $target->getName();
317 
318  $tools[] = Linker::link( $talkpage, $this->msg( 'sp-contributions-talk' )->escaped() );
319 
320  if ( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
321  if ( $this->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
322  if ( $target->isBlocked() && $target->getBlock()->getType() != Block::TYPE_AUTO ) {
323  $tools[] = Linker::linkKnown( # Change block link
324  SpecialPage::getTitleFor( 'Block', $username ),
325  $this->msg( 'change-blocklink' )->escaped()
326  );
327  $tools[] = Linker::linkKnown( # Unblock link
328  SpecialPage::getTitleFor( 'Unblock', $username ),
329  $this->msg( 'unblocklink' )->escaped()
330  );
331  } else { # User is not blocked
332  $tools[] = Linker::linkKnown( # Block link
333  SpecialPage::getTitleFor( 'Block', $username ),
334  $this->msg( 'blocklink' )->escaped()
335  );
336  }
337  }
338 
339  # Block log link
340  $tools[] = Linker::linkKnown(
341  SpecialPage::getTitleFor( 'Log', 'block' ),
342  $this->msg( 'sp-contributions-blocklog' )->escaped(),
343  [],
344  [ 'page' => $userpage->getPrefixedText() ]
345  );
346 
347  # Suppression log link (bug 59120)
348  if ( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
349  $tools[] = Linker::linkKnown(
350  SpecialPage::getTitleFor( 'Log', 'suppress' ),
351  $this->msg( 'sp-contributions-suppresslog' )->escaped(),
352  [],
353  [ 'offender' => $username ]
354  );
355  }
356  }
357  # Uploads
358  $tools[] = Linker::linkKnown(
359  SpecialPage::getTitleFor( 'Listfiles', $username ),
360  $this->msg( 'sp-contributions-uploads' )->escaped()
361  );
362 
363  # Other logs link
364  $tools[] = Linker::linkKnown(
365  SpecialPage::getTitleFor( 'Log', $username ),
366  $this->msg( 'sp-contributions-logs' )->escaped()
367  );
368 
369  # Add link to deleted user contributions for priviledged users
370  if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
371  $tools[] = Linker::linkKnown(
372  SpecialPage::getTitleFor( 'DeletedContributions', $username ),
373  $this->msg( 'sp-contributions-deleted' )->escaped()
374  );
375  }
376 
377  # Add a link to change user rights for privileged users
378  $userrightsPage = new UserrightsPage();
379  $userrightsPage->setContext( $this->getContext() );
380  if ( $userrightsPage->userCanChangeRights( $target ) ) {
381  $tools[] = Linker::linkKnown(
382  SpecialPage::getTitleFor( 'Userrights', $username ),
383  $this->msg( 'sp-contributions-userrights' )->escaped()
384  );
385  }
386 
387  Hooks::run( 'ContributionsToolLinks', [ $id, $userpage, &$tools ] );
388 
389  return $tools;
390  }
391 
396  protected function getForm() {
397  $this->opts['title'] = $this->getPageTitle()->getPrefixedText();
398  if ( !isset( $this->opts['target'] ) ) {
399  $this->opts['target'] = '';
400  } else {
401  $this->opts['target'] = str_replace( '_', ' ', $this->opts['target'] );
402  }
403 
404  if ( !isset( $this->opts['namespace'] ) ) {
405  $this->opts['namespace'] = '';
406  }
407 
408  if ( !isset( $this->opts['nsInvert'] ) ) {
409  $this->opts['nsInvert'] = '';
410  }
411 
412  if ( !isset( $this->opts['associated'] ) ) {
413  $this->opts['associated'] = false;
414  }
415 
416  if ( !isset( $this->opts['contribs'] ) ) {
417  $this->opts['contribs'] = 'user';
418  }
419 
420  if ( !isset( $this->opts['year'] ) ) {
421  $this->opts['year'] = '';
422  }
423 
424  if ( !isset( $this->opts['month'] ) ) {
425  $this->opts['month'] = '';
426  }
427 
428  if ( $this->opts['contribs'] == 'newbie' ) {
429  $this->opts['target'] = '';
430  }
431 
432  if ( !isset( $this->opts['tagfilter'] ) ) {
433  $this->opts['tagfilter'] = '';
434  }
435 
436  if ( !isset( $this->opts['topOnly'] ) ) {
437  $this->opts['topOnly'] = false;
438  }
439 
440  if ( !isset( $this->opts['newOnly'] ) ) {
441  $this->opts['newOnly'] = false;
442  }
443 
444  $form = Html::openElement(
445  'form',
446  [
447  'method' => 'get',
448  'action' => wfScript(),
449  'class' => 'mw-contributions-form'
450  ]
451  );
452 
453  # Add hidden params for tracking except for parameters in $skipParameters
454  $skipParameters = [
455  'namespace',
456  'nsInvert',
457  'deletedOnly',
458  'target',
459  'contribs',
460  'year',
461  'month',
462  'topOnly',
463  'newOnly',
464  'associated',
465  'tagfilter'
466  ];
467 
468  foreach ( $this->opts as $name => $value ) {
469  if ( in_array( $name, $skipParameters ) ) {
470  continue;
471  }
472  $form .= "\t" . Html::hidden( $name, $value ) . "\n";
473  }
474 
475  $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
476 
477  if ( $tagFilter ) {
478  $filterSelection = Html::rawElement(
479  'td',
480  [],
481  implode( '&#160;', $tagFilter )
482  );
483  } else {
484  $filterSelection = Html::rawElement( 'td', [ 'colspan' => 2 ], '' );
485  }
486 
487  $this->getOutput()->addModules( 'mediawiki.userSuggest' );
488 
489  $labelNewbies = Xml::radioLabel(
490  $this->msg( 'sp-contributions-newbies' )->text(),
491  'contribs',
492  'newbie',
493  'newbie',
494  $this->opts['contribs'] == 'newbie',
495  [ 'class' => 'mw-input' ]
496  );
497  $labelUsername = Xml::radioLabel(
498  $this->msg( 'sp-contributions-username' )->text(),
499  'contribs',
500  'user',
501  'user',
502  $this->opts['contribs'] == 'user',
503  [ 'class' => 'mw-input' ]
504  );
505  $input = Html::input(
506  'target',
507  $this->opts['target'],
508  'text',
509  [
510  'size' => '40',
511  'required' => '',
512  'class' => [
513  'mw-input',
514  'mw-ui-input-inline',
515  'mw-autocomplete-user', // used by mediawiki.userSuggest
516  ],
517  ] + (
518  // Only autofocus if target hasn't been specified or in non-newbies mode
519  ( $this->opts['contribs'] === 'newbie' || $this->opts['target'] )
520  ? [] : [ 'autofocus' => true ]
521  )
522  );
523 
524  $targetSelection = Html::rawElement(
525  'td',
526  [ 'colspan' => 2 ],
527  $labelNewbies . '<br />' . $labelUsername . ' ' . $input . ' '
528  );
529 
530  $namespaceSelection = Xml::tags(
531  'td',
532  [],
533  Xml::label(
534  $this->msg( 'namespace' )->text(),
535  'namespace',
536  ''
537  ) .
539  [ 'selected' => $this->opts['namespace'], 'all' => '' ],
540  [
541  'name' => 'namespace',
542  'id' => 'namespace',
543  'class' => 'namespaceselector',
544  ]
545  ) . '&#160;' .
547  'span',
548  [ 'class' => 'mw-input-with-label' ],
550  $this->msg( 'invert' )->text(),
551  'nsInvert',
552  'nsInvert',
553  $this->opts['nsInvert'],
554  [
555  'title' => $this->msg( 'tooltip-invert' )->text(),
556  'class' => 'mw-input'
557  ]
558  ) . '&#160;'
559  ) .
560  Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' ],
562  $this->msg( 'namespace_association' )->text(),
563  'associated',
564  'associated',
565  $this->opts['associated'],
566  [
567  'title' => $this->msg( 'tooltip-namespace_association' )->text(),
568  'class' => 'mw-input'
569  ]
570  ) . '&#160;'
571  )
572  );
573 
574  $filters = [];
575 
576  if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
577  $filters[] = Html::rawElement(
578  'span',
579  [ 'class' => 'mw-input-with-label' ],
581  $this->msg( 'history-show-deleted' )->text(),
582  'deletedOnly',
583  'mw-show-deleted-only',
584  $this->opts['deletedOnly'],
585  [ 'class' => 'mw-input' ]
586  )
587  );
588  }
589 
590  $filters[] = Html::rawElement(
591  'span',
592  [ 'class' => 'mw-input-with-label' ],
594  $this->msg( 'sp-contributions-toponly' )->text(),
595  'topOnly',
596  'mw-show-top-only',
597  $this->opts['topOnly'],
598  [ 'class' => 'mw-input' ]
599  )
600  );
601  $filters[] = Html::rawElement(
602  'span',
603  [ 'class' => 'mw-input-with-label' ],
605  $this->msg( 'sp-contributions-newonly' )->text(),
606  'newOnly',
607  'mw-show-new-only',
608  $this->opts['newOnly'],
609  [ 'class' => 'mw-input' ]
610  )
611  );
612 
613  Hooks::run(
614  'SpecialContributions::getForm::filters',
615  [ $this, &$filters ]
616  );
617 
618  $extraOptions = Html::rawElement(
619  'td',
620  [ 'colspan' => 2 ],
621  implode( '', $filters )
622  );
623 
624  $dateSelectionAndSubmit = Xml::tags( 'td', [ 'colspan' => 2 ],
626  $this->opts['year'] === '' ? MWTimestamp::getInstance()->format( 'Y' ) : $this->opts['year'],
627  $this->opts['month']
628  ) . ' ' .
630  $this->msg( 'sp-contributions-submit' )->text(),
631  [ 'class' => 'mw-submit' ], [ 'mw-ui-progressive' ]
632  )
633  );
634 
635  $form .= Xml::fieldset( $this->msg( 'sp-contributions-search' )->text() );
636  $form .= Html::rawElement( 'table', [ 'class' => 'mw-contributions-table' ], "\n" .
637  Html::rawElement( 'tr', [], $targetSelection ) . "\n" .
638  Html::rawElement( 'tr', [], $namespaceSelection ) . "\n" .
639  Html::rawElement( 'tr', [], $filterSelection ) . "\n" .
640  Html::rawElement( 'tr', [], $extraOptions ) . "\n" .
641  Html::rawElement( 'tr', [], $dateSelectionAndSubmit ) . "\n"
642  );
643 
644  $explain = $this->msg( 'sp-contributions-explain' );
645  if ( !$explain->isBlank() ) {
646  $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>";
647  }
648 
649  $form .= Xml::closeElement( 'fieldset' ) . Xml::closeElement( 'form' );
650 
651  return $form;
652  }
653 
662  public function prefixSearchSubpages( $search, $limit, $offset ) {
663  $user = User::newFromName( $search );
664  if ( !$user ) {
665  // No prefix suggestion for invalid user
666  return [];
667  }
668  // Autocomplete subpage as user list - public to allow caching
669  return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
670  }
671 
672  protected function getGroupName() {
673  return 'users';
674  }
675 }
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
Definition: User.php:568
prefixSearchSubpages($search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
null means default in associative array form
Definition: hooks.txt:1798
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
getContext()
Gets the context this SpecialPage is executed in.
wfScript($script= 'index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
const TYPE_RANGE
Definition: Block.php:77
getForm()
Generates the namespace selector form with hidden attributes.
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
Definition: Html.php:210
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:189
addFeedLinks($params)
Adds RSS/atom links.
null for the local wiki Added in
Definition: hooks.txt:1418
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition: hooks.txt:177
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.
static isIPAddress($ip)
Determine if a string is as valid IP address or network (CIDR prefix).
Definition: IP.php:79
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
static label($label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition: Xml.php:359
static showLogExtract(&$out, $types=[], $page= '', $user= '', $param=[])
Show log extract.
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:1798
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
wfGetLB($wiki=false)
Get a load balancer object.
wfEscapeWikiText($text)
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
Shortcut to construct an includable special page.
static getCanonicalName($index)
Returns the canonical (English) name for a given index.
wfAppendQuery($url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
Special:Contributions, show user contributions in a paged list.
static newFromTarget($specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
Definition: Block.php:1077
as see the revision history and logs
Definition: LICENSE.txt:5
static search($audience, $search, $limit, $offset=0)
Do a prefix search of user names and return a list of matching user names.
static getInstance($ts=false)
Get a timestamp instance in GMT.
static dateMenu($year, $month)
Definition: Xml.php:167
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Wikitext formatted, in the key only.
Definition: distributors.txt:9
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! ...
static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:548
static isIP($name)
Does the string match an anonymous IPv4 address?
Definition: User.php:830
title
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
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 TYPE_AUTO
Definition: Block.php:78
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 local account $user
Definition: hooks.txt:242
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
Definition: Linker.php:195
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 & $output
Definition: hooks.txt:1004
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
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 change
Definition: distributors.txt:9
static tags($element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
static submitButton($contents, array $attrs, array $modifiers=[])
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enab...
Definition: Html.php:186
error also a ContextSource you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2418
action
getUser()
Shortcut to get the User executing this instance.
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
contributionsSub($userObj)
Generates the subheading with links.
Pager for Special:Contributions.
getUserLinks(Title $userpage, Title $talkpage, User $target)
Links to different places.
getRequest()
Get the WebRequest being used for this instance.
Definition: Block.php:22
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 page
Definition: hooks.txt:2338
if the prop value should be in the metadata multi language array format
Definition: hooks.txt:1473
this hook is for auditing only etc instead of letting the login form give the generic error message that the account does not exist For when the account has been renamed or deleted or an array to pass a message key and parameters block
Definition: hooks.txt:1946
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
Definition: Html.php:847