MediaWiki REL1_32
ChangesList.php
Go to the documentation of this file.
1<?php
27
29 const CSS_CLASS_PREFIX = 'mw-changeslist-';
30
34 public $skin;
35
36 protected $watchlist = false;
37 protected $lastdate;
38 protected $message;
39 protected $rc_cache;
40 protected $rcCacheIndex;
41 protected $rclistOpen;
42 protected $rcMoveIndex;
43
46
48 protected $watchMsgCache;
49
53 protected $linkRenderer;
54
58 protected $filterGroups;
59
66 public function __construct( $obj, array $filterGroups = [] ) {
67 if ( $obj instanceof IContextSource ) {
68 $this->setContext( $obj );
69 $this->skin = $obj->getSkin();
70 } else {
71 $this->setContext( $obj->getContext() );
72 $this->skin = $obj;
73 }
74 $this->preCacheMessages();
75 $this->watchMsgCache = new MapCacheLRU( 50 );
76 $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
77 $this->filterGroups = $filterGroups;
78 }
79
88 public static function newFromContext( IContextSource $context, array $groups = [] ) {
90 $sk = $context->getSkin();
91 $list = null;
92 if ( Hooks::run( 'FetchChangesList', [ $user, &$sk, &$list ] ) ) {
93 $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
94
95 return $new ?
96 new EnhancedChangesList( $context, $groups ) :
97 new OldChangesList( $context, $groups );
98 } else {
99 return $list;
100 }
101 }
102
114 public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
115 throw new RuntimeException( 'recentChangesLine should be implemented' );
116 }
117
124 protected function getHighlightsContainerDiv() {
125 $highlightColorDivs = '';
126 foreach ( [ 'none', 'c1', 'c2', 'c3', 'c4', 'c5' ] as $color ) {
127 $highlightColorDivs .= Html::rawElement(
128 'div',
129 [
130 'class' => 'mw-rcfilters-ui-highlights-color-' . $color,
131 'data-color' => $color
132 ]
133 );
134 }
135
136 return Html::rawElement(
137 'div',
138 [ 'class' => 'mw-rcfilters-ui-highlights' ],
139 $highlightColorDivs
140 );
141 }
142
147 public function setWatchlistDivs( $value = true ) {
148 $this->watchlist = $value;
149 }
150
155 public function isWatchlist() {
156 return (bool)$this->watchlist;
157 }
158
163 private function preCacheMessages() {
164 if ( !isset( $this->message ) ) {
165 foreach ( [
166 'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
167 'semicolon-separator', 'pipe-separator' ] as $msg
168 ) {
169 $this->message[$msg] = $this->msg( $msg )->escaped();
170 }
171 }
172 }
173
180 public function recentChangesFlags( $flags, $nothing = "\u{00A0}" ) {
181 $f = '';
182 foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
183 $f .= isset( $flags[$flag] ) && $flags[$flag]
184 ? self::flag( $flag, $this->getContext() )
185 : $nothing;
186 }
187
188 return $f;
189 }
190
199 protected function getHTMLClasses( $rc, $watched ) {
200 $classes = [ self::CSS_CLASS_PREFIX . 'line' ];
201 $logType = $rc->mAttribs['rc_log_type'];
202
203 if ( $logType ) {
204 $classes[] = self::CSS_CLASS_PREFIX . 'log';
205 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'log-' . $logType );
206 } else {
207 $classes[] = self::CSS_CLASS_PREFIX . 'edit';
208 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns' .
209 $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
210 }
211
212 // Indicate watched status on the line to allow for more
213 // comprehensive styling.
214 $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
215 ? self::CSS_CLASS_PREFIX . 'line-watched'
216 : self::CSS_CLASS_PREFIX . 'line-not-watched';
217
218 $classes = array_merge( $classes, $this->getHTMLClassesForFilters( $rc ) );
219
220 return $classes;
221 }
222
230 protected function getHTMLClassesForFilters( $rc ) {
231 $classes = [];
232
233 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' .
234 $rc->mAttribs['rc_namespace'] );
235
236 if ( $this->filterGroups !== null ) {
237 foreach ( $this->filterGroups as $filterGroup ) {
238 foreach ( $filterGroup->getFilters() as $filter ) {
239 $filter->applyCssClassIfNeeded( $this, $rc, $classes );
240 }
241 }
242 }
243
244 return $classes;
245 }
246
255 public static function flag( $flag, IContextSource $context = null ) {
256 static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
257 static $flagInfos = null;
258
259 if ( is_null( $flagInfos ) ) {
261 $flagInfos = [];
262 foreach ( $wgRecentChangesFlags as $key => $value ) {
263 $flagInfos[$key]['letter'] = $value['letter'];
264 $flagInfos[$key]['title'] = $value['title'];
265 // Allow customized class name, fall back to flag name
266 $flagInfos[$key]['class'] = $value['class'] ?? $key;
267 }
268 }
269
270 $context = $context ?: RequestContext::getMain();
271
272 // Inconsistent naming, kepted for b/c
273 if ( isset( $map[$flag] ) ) {
274 $flag = $map[$flag];
275 }
276
277 $info = $flagInfos[$flag];
278 return Html::element( 'abbr', [
279 'class' => $info['class'],
280 'title' => wfMessage( $info['title'] )->setContext( $context )->text(),
281 ], wfMessage( $info['letter'] )->setContext( $context )->text() );
282 }
283
288 public function beginRecentChangesList() {
289 $this->rc_cache = [];
290 $this->rcMoveIndex = 0;
291 $this->rcCacheIndex = 0;
292 $this->lastdate = '';
293 $this->rclistOpen = false;
294 $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
295
296 return '<div class="mw-changeslist">';
297 }
298
302 public function initChangesListRows( $rows ) {
303 Hooks::run( 'ChangesListInitRows', [ $this, $rows ] );
304 }
305
316 public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
317 if ( !$context ) {
318 $context = RequestContext::getMain();
319 }
320
321 $new = (int)$new;
322 $old = (int)$old;
323 $szdiff = $new - $old;
324
326 $config = $context->getConfig();
327 $code = $lang->getCode();
328 static $fastCharDiff = [];
329 if ( !isset( $fastCharDiff[$code] ) ) {
330 $fastCharDiff[$code] = $config->get( 'MiserMode' )
331 || $context->msg( 'rc-change-size' )->plain() === '$1';
332 }
333
334 $formattedSize = $lang->formatNum( $szdiff );
335
336 if ( !$fastCharDiff[$code] ) {
337 $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
338 }
339
340 if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) {
341 $tag = 'strong';
342 } else {
343 $tag = 'span';
344 }
345
346 if ( $szdiff === 0 ) {
347 $formattedSizeClass = 'mw-plusminus-null';
348 } elseif ( $szdiff > 0 ) {
349 $formattedSize = '+' . $formattedSize;
350 $formattedSizeClass = 'mw-plusminus-pos';
351 } else {
352 $formattedSizeClass = 'mw-plusminus-neg';
353 }
354
355 $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
356
357 return Html::element( $tag,
358 [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
359 $context->msg( 'parentheses', $formattedSize )->plain() ) . $lang->getDirMark();
360 }
361
369 public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
370 $oldlen = $old->mAttribs['rc_old_len'];
371
372 if ( $new ) {
373 $newlen = $new->mAttribs['rc_new_len'];
374 } else {
375 $newlen = $old->mAttribs['rc_new_len'];
376 }
377
378 if ( $oldlen === null || $newlen === null ) {
379 return '';
380 }
381
382 return self::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
383 }
384
389 public function endRecentChangesList() {
390 $out = $this->rclistOpen ? "</ul>\n" : '';
391 $out .= '</div>';
392
393 return $out;
394 }
395
400 public function insertDateHeader( &$s, $rc_timestamp ) {
401 # Make date header if necessary
402 $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
403 if ( $date != $this->lastdate ) {
404 if ( $this->lastdate != '' ) {
405 $s .= "</ul>\n";
406 }
407 $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
408 $this->lastdate = $date;
409 $this->rclistOpen = true;
410 }
411 }
412
418 public function insertLog( &$s, $title, $logtype ) {
419 $page = new LogPage( $logtype );
420 $logname = $page->getName()->setContext( $this->getContext() )->text();
421 $s .= $this->msg( 'parentheses' )->rawParams(
422 $this->linkRenderer->makeKnownLink( $title, $logname )
423 )->escaped();
424 }
425
431 public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
432 # Diff link
433 if (
434 $rc->mAttribs['rc_type'] == RC_NEW ||
435 $rc->mAttribs['rc_type'] == RC_LOG ||
436 $rc->mAttribs['rc_type'] == RC_CATEGORIZE
437 ) {
438 $diffLink = $this->message['diff'];
439 } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
440 $diffLink = $this->message['diff'];
441 } else {
442 $query = [
443 'curid' => $rc->mAttribs['rc_cur_id'],
444 'diff' => $rc->mAttribs['rc_this_oldid'],
445 'oldid' => $rc->mAttribs['rc_last_oldid']
446 ];
447
448 $diffLink = $this->linkRenderer->makeKnownLink(
449 $rc->getTitle(),
450 new HtmlArmor( $this->message['diff'] ),
451 [ 'class' => 'mw-changeslist-diff' ],
452 $query
453 );
454 }
455 if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
456 $diffhist = $diffLink . $this->message['pipe-separator'] . $this->message['hist'];
457 } else {
458 $diffhist = $diffLink . $this->message['pipe-separator'];
459 # History link
460 $diffhist .= $this->linkRenderer->makeKnownLink(
461 $rc->getTitle(),
462 new HtmlArmor( $this->message['hist'] ),
463 [ 'class' => 'mw-changeslist-history' ],
464 [
465 'curid' => $rc->mAttribs['rc_cur_id'],
466 'action' => 'history'
467 ]
468 );
469 }
470
471 // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
472 $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() .
473 ' <span class="mw-changeslist-separator">. .</span> ';
474 }
475
483 public function insertArticleLink( &$s, RecentChange $rc, $unpatrolled, $watched ) {
484 $s .= $this->getArticleLink( $rc, $unpatrolled, $watched );
485 }
486
494 public function getArticleLink( &$rc, $unpatrolled, $watched ) {
495 $params = [];
496 if ( $rc->getTitle()->isRedirect() ) {
497 $params = [ 'redirect' => 'no' ];
498 }
499
500 $articlelink = $this->linkRenderer->makeLink(
501 $rc->getTitle(),
502 null,
503 [ 'class' => 'mw-changeslist-title' ],
504 $params
505 );
506 if ( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
507 $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
508 }
509 # To allow for boldening pages watched by this user
510 $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
511 # RTL/LTR marker
512 $articlelink .= $this->getLanguage()->getDirMark();
513
514 # TODO: Deprecate the $s argument, it seems happily unused.
515 $s = '';
516 # Avoid PHP 7.1 warning from passing $this by reference
517 $changesList = $this;
518 Hooks::run( 'ChangesListInsertArticleLink',
519 [ &$changesList, &$articlelink, &$s, &$rc, $unpatrolled, $watched ] );
520
521 return "{$s} {$articlelink}";
522 }
523
531 public function getTimestamp( $rc ) {
532 // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
533 return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
534 htmlspecialchars( $this->getLanguage()->userTime(
535 $rc->mAttribs['rc_timestamp'],
536 $this->getUser()
537 ) ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
538 }
539
546 public function insertTimestamp( &$s, $rc ) {
547 $s .= $this->getTimestamp( $rc );
548 }
549
556 public function insertUserRelatedLinks( &$s, &$rc ) {
557 if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
558 $s .= ' <span class="history-deleted">' .
559 $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
560 } else {
561 $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
562 $rc->mAttribs['rc_user_text'] );
563 $s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
564 }
565 }
566
573 public function insertLogEntry( $rc ) {
574 $formatter = LogFormatter::newFromRow( $rc->mAttribs );
575 $formatter->setContext( $this->getContext() );
576 $formatter->setShowUserToolLinks( true );
577 $mark = $this->getLanguage()->getDirMark();
578
579 return $formatter->getActionText() . " $mark" . $formatter->getComment();
580 }
581
587 public function insertComment( $rc ) {
588 if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
589 return ' <span class="history-deleted">' .
590 $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
591 } else {
592 return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
593 }
594 }
595
601 protected function numberofWatchingusers( $count ) {
602 if ( $count <= 0 ) {
603 return '';
604 }
605
606 return $this->watchMsgCache->getWithSetCallback(
607 "watching-users-msg:$count",
608 function () use ( $count ) {
609 return $this->msg( 'number_of_watching_users_RCview' )
610 ->numParams( $count )->escaped();
611 }
612 );
613 }
614
621 public static function isDeleted( $rc, $field ) {
622 return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
623 }
624
633 public static function userCan( $rc, $field, User $user = null ) {
634 if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
635 return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
636 } else {
637 return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
638 }
639 }
640
646 protected function maybeWatchedLink( $link, $watched = false ) {
647 if ( $watched ) {
648 return '<strong class="mw-watched">' . $link . '</strong>';
649 } else {
650 return '<span class="mw-rc-unwatched">' . $link . '</span>';
651 }
652 }
653
660 public function insertRollback( &$s, &$rc ) {
661 if ( $rc->mAttribs['rc_type'] == RC_EDIT
662 && $rc->mAttribs['rc_this_oldid']
663 && $rc->mAttribs['rc_cur_id']
664 && $rc->getAttribute( 'page_latest' ) == $rc->mAttribs['rc_this_oldid']
665 ) {
666 $title = $rc->getTitle();
669 if ( $title->quickUserCan( 'rollback', $this->getUser() ) ) {
670 $rev = new Revision( [
671 'title' => $title,
672 'id' => $rc->mAttribs['rc_this_oldid'],
673 'user' => $rc->mAttribs['rc_user'],
674 'user_text' => $rc->mAttribs['rc_user_text'],
675 'actor' => $rc->mAttribs['rc_actor'] ?? null,
676 'deleted' => $rc->mAttribs['rc_deleted']
677 ] );
678 $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
679 }
680 }
681 }
682
688 public function getRollback( RecentChange $rc ) {
689 $s = '';
690 $this->insertRollback( $s, $rc );
691 return $s;
692 }
693
699 public function insertTags( &$s, &$rc, &$classes ) {
700 if ( empty( $rc->mAttribs['ts_tags'] ) ) {
701 return;
702 }
703
704 list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
705 $rc->mAttribs['ts_tags'],
706 'changeslist',
707 $this->getContext()
708 );
709 $classes = array_merge( $classes, $newClasses );
710 $s .= ' ' . $tagSummary;
711 }
712
719 public function getTags( RecentChange $rc, array &$classes ) {
720 $s = '';
721 $this->insertTags( $s, $rc, $classes );
722 return $s;
723 }
724
725 public function insertExtra( &$s, &$rc, &$classes ) {
726 // Empty, used for subclasses to add anything special.
727 }
728
729 protected function showAsUnpatrolled( RecentChange $rc ) {
730 return self::isUnpatrolled( $rc, $this->getUser() );
731 }
732
738 public static function isUnpatrolled( $rc, User $user ) {
739 if ( $rc instanceof RecentChange ) {
740 $isPatrolled = $rc->mAttribs['rc_patrolled'];
741 $rcType = $rc->mAttribs['rc_type'];
742 $rcLogType = $rc->mAttribs['rc_log_type'];
743 } else {
744 $isPatrolled = $rc->rc_patrolled;
745 $rcType = $rc->rc_type;
746 $rcLogType = $rc->rc_log_type;
747 }
748
749 if ( !$isPatrolled ) {
750 if ( $user->useRCPatrol() ) {
751 return true;
752 }
753 if ( $user->useNPPatrol() && $rcType == RC_NEW ) {
754 return true;
755 }
756 if ( $user->useFilePatrol() && $rcLogType == 'upload' ) {
757 return true;
758 }
759 }
760
761 return false;
762 }
763
773 protected function isCategorizationWithoutRevision( $rcObj ) {
774 return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
775 && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
776 }
777
783 protected function getDataAttributes( RecentChange $rc ) {
784 $attrs = [];
785
786 $type = $rc->getAttribute( 'rc_source' );
787 switch ( $type ) {
788 case RecentChange::SRC_EDIT:
789 case RecentChange::SRC_NEW:
790 $attrs['data-mw-revid'] = $rc->mAttribs['rc_this_oldid'];
791 break;
792 case RecentChange::SRC_LOG:
793 $attrs['data-mw-logid'] = $rc->mAttribs['rc_logid'];
794 $attrs['data-mw-logaction'] =
795 $rc->mAttribs['rc_log_type'] . '/' . $rc->mAttribs['rc_log_action'];
796 break;
797 }
798
799 $attrs[ 'data-mw-ts' ] = $rc->getAttribute( 'rc_timestamp' );
800
801 return $attrs;
802 }
803
811 public function setChangeLinePrefixer( callable $prefixer ) {
812 $this->changeLinePrefixer = $prefixer;
813 }
814}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
$wgRecentChangesFlags
Flags (letter symbols) shown in recent changes and watchlist to indicate certain types of edits.
static newFromContext(IContextSource $context, array $groups=[])
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
maybeWatchedLink( $link, $watched=false)
static userCan( $rc, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
setWatchlistDivs( $value=true)
Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag.
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
insertDateHeader(&$s, $rc_timestamp)
insertRollback(&$s, &$rc)
Insert a rollback link.
showAsUnpatrolled(RecentChange $rc)
static isUnpatrolled( $rc, User $user)
array $filterGroups
getHighlightsContainerDiv()
Get the container for highlights that are used in the new StructuredFilters system.
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line.
recentChangesFlags( $flags, $nothing="\u{00A0}")
Returns the appropriate flags for new page, minor change and patrolling.
getDataAttributes(RecentChange $rc)
Get recommended data attributes for a change line.
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
getHTMLClasses( $rc, $watched)
Get an array of default HTML class attributes for the change.
insertLog(&$s, $title, $logtype)
callable $changeLinePrefixer
getTags(RecentChange $rc, array &$classes)
getArticleLink(&$rc, $unpatrolled, $watched)
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
insertArticleLink(&$s, RecentChange $rc, $unpatrolled, $watched)
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
getRollback(RecentChange $rc)
MapCacheLRU $watchMsgCache
endRecentChangesList()
Returns text for the end of RC.
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
LinkRenderer $linkRenderer
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
insertLogEntry( $rc)
Insert a formatted action.
setChangeLinePrefixer(callable $prefixer)
Sets the callable that generates a change line prefix added to the beginning of each line.
static isDeleted( $rc, $field)
Determine if said field of a revision is hidden.
const CSS_CLASS_PREFIX
insertTags(&$s, &$rc, &$classes)
insertComment( $rc)
Insert a formatted comment.
insertExtra(&$s, &$rc, &$classes)
__construct( $obj, array $filterGroups=[])
Changeslist constructor.
initChangesListRows( $rows)
getTimestamp( $rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
isCategorizationWithoutRevision( $rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
getHTMLClassesForFilters( $rc)
Get an array of CSS classes attributed to filters for this row.
insertDiffHist(&$s, &$rc, $unpatrolled=null)
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
IContextSource $context
getContext()
Get the base IContextSource object.
setContext(IContextSource $context)
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:28
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
Definition Linker.php:1704
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition Linker.php:876
static commentBlock( $comment, $title=null, $local=false, $wikiId=null)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
Definition Linker.php:1441
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
Definition Linker.php:914
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
Class to simplify the use of log pages.
Definition LogPage.php:33
Handles a simple LRU key/value map with a maximum number of entries.
Class that generates HTML links for pages.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Utility class for creating new RC entries.
getAttribute( $name)
Get an attribute value.
const DELETED_USER
Definition Revision.php:49
const DELETED_TEXT
Definition Revision.php:47
static userCanBitfield( $bitfield, $field, User $user=null, Title $title=null)
Determine if the current user is allowed to view a particular field of this revision,...
const DELETED_COMMENT
Definition Revision.php:48
The main skin class which provides methods and properties for all other skins.
Definition Skin.php:38
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:47
Result wrapper for grabbing data queried from an IDatabase object.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11
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
const RC_NEW
Definition Defines.php:143
const RC_LOG
Definition Defines.php:144
const RC_EDIT
Definition Defines.php:142
const RC_CATEGORIZE
Definition Defines.php:146
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
Definition hooks.txt:2857
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges $changesList
Definition hooks.txt:1580
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:994
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 modifiable & $code
Definition hooks.txt:895
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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:894
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a message
Definition hooks.txt:2213
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition hooks.txt:3106
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:1656
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition hooks.txt:1818
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:247
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:37
Interface for objects which can provide a MediaWiki context on request.
getConfig()
Get the site configuration.
msg( $key)
This is the method for getting translated interface messages.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
$params
if(!isset( $args[0])) $lang