Follow-up on r55909: showLogExtract can now tell Pager to ignore wgRequest offset...
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
1 <?php
2 /**
3 * Special:Contributions, show user contributions in a paged list
4 * @file
5 * @ingroup SpecialPage
6 */
7
8 class SpecialContributions extends SpecialPage {
9
10 public function __construct() {
11 parent::__construct( 'Contributions' );
12 }
13
14 public function execute( $par ) {
15 global $wgUser, $wgOut, $wgLang, $wgRequest;
16
17 $this->setHeaders();
18 $this->outputHeader();
19
20 $this->opts = array();
21
22 if( $par == 'newbies' ) {
23 $target = 'newbies';
24 $this->opts['contribs'] = 'newbie';
25 } elseif( isset( $par ) ) {
26 $target = $par;
27 } else {
28 $target = $wgRequest->getVal( 'target' );
29 }
30
31 // check for radiobox
32 if( $wgRequest->getVal( 'contribs' ) == 'newbie' ) {
33 $target = 'newbies';
34 $this->opts['contribs'] = 'newbie';
35 }
36
37 if( !strlen( $target ) ) {
38 $wgOut->addHTML( $this->getForm() );
39 return;
40 }
41
42 $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
43 $this->opts['target'] = $target;
44
45 $nt = Title::makeTitleSafe( NS_USER, $target );
46 if( !$nt ) {
47 $wgOut->addHTML( $this->getForm() );
48 return;
49 }
50 $id = User::idFromName( $nt->getText() );
51
52 if( $target != 'newbies' ) {
53 $target = $nt->getText();
54 $wgOut->setSubtitle( $this->contributionsSub( $nt, $id ) );
55 $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) );
56 } else {
57 $wgOut->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') );
58 $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) );
59 }
60
61 if( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
62 $this->opts['namespace'] = intval( $ns );
63 } else {
64 $this->opts['namespace'] = '';
65 }
66
67 $this->opts['tagfilter'] = (string) $wgRequest->getVal( 'tagfilter' );
68
69 // Allows reverts to have the bot flag in recent changes. It is just here to
70 // be passed in the form at the top of the page
71 if( $wgUser->isAllowed( 'markbotedits' ) && $wgRequest->getBool( 'bot' ) ) {
72 $this->opts['bot'] = '1';
73 }
74
75 $skip = $wgRequest->getText( 'offset' ) || $wgRequest->getText( 'dir' ) == 'prev';
76 # Offset overrides year/month selection
77 if( $skip ) {
78 $this->opts['year'] = '';
79 $this->opts['month'] = '';
80 } else {
81 $this->opts['year'] = $wgRequest->getIntOrNull( 'year' );
82 $this->opts['month'] = $wgRequest->getIntOrNull( 'month' );
83 }
84
85 // Add RSS/atom links
86 $this->setSyndicated();
87 $feedType = $wgRequest->getVal( 'feed' );
88 if( $feedType ) {
89 return $this->feed( $feedType );
90 }
91
92 wfRunHooks( 'SpecialContributionsBeforeMainOutput', $id );
93
94 $wgOut->addHTML( $this->getForm() );
95
96 $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'], $this->opts['month'] );
97 if( !$pager->getNumRows() ) {
98 $wgOut->addWikiMsg( 'nocontribs', $target );
99 } else {
100 # Show a message about slave lag, if applicable
101 if( ( $lag = $pager->getDatabase()->getLag() ) > 0 )
102 $wgOut->showLagWarning( $lag );
103
104 $wgOut->addHTML(
105 '<p>' . $pager->getNavigationBar() . '</p>' .
106 $pager->getBody() .
107 '<p>' . $pager->getNavigationBar() . '</p>'
108 );
109 }
110
111
112 # Show the appropriate "footer" message - WHOIS tools, etc.
113 if( $target != 'newbies' ) {
114 $message = 'sp-contributions-footer';
115 if ( IP::isIPAddress( $target ) ) {
116 $message = 'sp-contributions-footer-anon';
117 } else {
118 $user = User::newFromName( $target );
119 if ( !$user || $user->isAnon() ) {
120 // No message for non-existing users
121 return;
122 }
123 }
124
125 $text = wfMsgNoTrans( $message, $target );
126 if( !wfEmptyMsg( $message, $text ) && $text != '-' ) {
127 $wgOut->wrapWikiMsg(
128 "<div class='mw-contributions-footer'>\n$1\n</div>",
129 array( $message, $target ) );
130 }
131 }
132 }
133
134 protected function setSyndicated() {
135 global $wgOut;
136 $queryParams = array(
137 'namespace' => $this->opts['namespace'],
138 'target' => $this->opts['target']
139 );
140 $wgOut->setSyndicated( true );
141 $wgOut->setFeedAppendQuery( wfArrayToCGI( $queryParams ) );
142 }
143
144 /**
145 * Generates the subheading with links
146 * @param Title $nt Title object for the target
147 * @param integer $id User ID for the target
148 * @return String: appropriately-escaped HTML to be output literally
149 */
150 protected function contributionsSub( $nt, $id ) {
151 global $wgSysopUserBans, $wgLang, $wgUser, $wgOut;
152
153 $sk = $wgUser->getSkin();
154
155 if( 0 == $id ) {
156 $user = htmlspecialchars( $nt->getText() );
157 } else {
158 $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
159 }
160 $talk = $nt->getTalkPage();
161 if( $talk ) {
162 # Talk page link
163 $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
164 if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && IP::isIPAddress( $nt->getText() ) ) ) {
165 if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
166 if ( User::newFromId( $id )->isBlocked() ) {
167 $tools[] = $sk->linkKnown( # Change block link
168 SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
169 wfMsgHtml( 'change-blocklink' )
170 );
171 $tools[] = $sk->linkKnown( # Unblock link
172 SpecialPage::getTitleFor( 'BlockList' ),
173 wfMsgHtml( 'unblocklink' ),
174 array(),
175 array(
176 'action' => 'unblock',
177 'ip' => $nt->getDBkey()
178 )
179 );
180 }
181 else { # User is not blocked
182 $tools[] = $sk->linkKnown( # Block link
183 SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
184 wfMsgHtml( 'blocklink' )
185 );
186 }
187 }
188 # Block log link
189 $tools[] = $sk->linkKnown(
190 SpecialPage::getTitleFor( 'Log' ),
191 wfMsgHtml( 'sp-contributions-blocklog' ),
192 array(),
193 array(
194 'type' => 'block',
195 'page' => $nt->getPrefixedText()
196 )
197 );
198 }
199 # Other logs link
200 $tools[] = $sk->linkKnown(
201 SpecialPage::getTitleFor( 'Log' ),
202 wfMsgHtml( 'sp-contributions-logs' ),
203 array(),
204 array( 'user' => $nt->getText() )
205 );
206
207 # Add link to deleted user contributions for priviledged users
208 if( $wgUser->isAllowed( 'deletedhistory' ) ) {
209 $tools[] = $sk->linkKnown(
210 SpecialPage::getTitleFor( 'DeletedContributions', $nt->getDBkey() ),
211 wfMsgHtml( 'sp-contributions-deleted' )
212 );
213 }
214
215 # Add a link to change user rights for privileged users
216 $userrightsPage = new UserrightsPage();
217 if( 0 !== $id && $userrightsPage->userCanChangeRights( User::newFromId( $id ) ) ) {
218 $tools[] = $sk->linkKnown(
219 SpecialPage::getTitleFor( 'Userrights', $nt->getDBkey() ),
220 wfMsgHtml( 'sp-contributions-userrights' )
221 );
222 }
223
224 wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );
225
226 $links = $wgLang->pipeList( $tools );
227
228 // Show a note if the user is blocked and display the last block log entry.
229 if ( User::newFromID( $id )->isBlocked() ) {
230 LogEventsList::showLogExtract(
231 $wgOut,
232 'block',
233 $nt->getPrefixedText(),
234 '',
235 array(
236 'lim' => 1,
237 'showIfEmpty' => false,
238 'msgKey' => array( 'sp-contributions-blocked-notice' ),
239 'offset' => '' # don't use $wgRequest parameter offset
240 )
241 );
242 }
243 }
244
245 // Old message 'contribsub' had one parameter, but that doesn't work for
246 // languages that want to put the "for" bit right after $user but before
247 // $links. If 'contribsub' is around, use it for reverse compatibility,
248 // otherwise use 'contribsub2'.
249 if( wfEmptyMsg( 'contribsub', wfMsg( 'contribsub' ) ) ) {
250 return wfMsgHtml( 'contribsub2', $user, $links );
251 } else {
252 return wfMsgHtml( 'contribsub', "$user ($links)" );
253 }
254 }
255
256 /**
257 * Generates the namespace selector form with hidden attributes.
258 * @param $this->opts Array: the options to be included.
259 */
260 protected function getForm() {
261 global $wgScript;
262
263 $this->opts['title'] = $this->getTitle()->getPrefixedText();
264 if( !isset( $this->opts['target'] ) ) {
265 $this->opts['target'] = '';
266 } else {
267 $this->opts['target'] = str_replace( '_' , ' ' , $this->opts['target'] );
268 }
269
270 if( !isset( $this->opts['namespace'] ) ) {
271 $this->opts['namespace'] = '';
272 }
273
274 if( !isset( $this->opts['contribs'] ) ) {
275 $this->opts['contribs'] = 'user';
276 }
277
278 if( !isset( $this->opts['year'] ) ) {
279 $this->opts['year'] = '';
280 }
281
282 if( !isset( $this->opts['month'] ) ) {
283 $this->opts['month'] = '';
284 }
285
286 if( $this->opts['contribs'] == 'newbie' ) {
287 $this->opts['target'] = '';
288 }
289
290 if( !isset( $this->opts['tagfilter'] ) ) {
291 $this->opts['tagfilter'] = '';
292 }
293
294 $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
295 # Add hidden params for tracking
296 foreach ( $this->opts as $name => $value ) {
297 if( in_array( $name, array( 'namespace', 'target', 'contribs', 'year', 'month' ) ) ) {
298 continue;
299 }
300 $f .= "\t" . Xml::hidden( $name, $value ) . "\n";
301 }
302
303 $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
304
305 $f .= '<fieldset>' .
306 Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
307 Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parsemag' ) ),
308 'contribs', 'newbie' , 'newbie', $this->opts['contribs'] == 'newbie' ? true : false ) . '<br />' .
309 Xml::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parsemag' ) ),
310 'contribs' , 'user', 'user', $this->opts['contribs'] == 'user' ? true : false ) . ' ' .
311 Html::input( 'target', $this->opts['target'], 'text', array(
312 'size' => '20',
313 'required' => ''
314 ) + ( $this->opts['target'] ? array() : array( 'autofocus' ) ) ) . ' '.
315 '<span style="white-space: nowrap">' .
316 Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' .
317 Xml::namespaceSelector( $this->opts['namespace'], '' ) .
318 '</span>' .
319 ( $tagFilter ? Xml::tags( 'p', null, implode( '&nbsp;', $tagFilter ) ) : '' ) .
320 Xml::openElement( 'p' ) .
321 '<span style="white-space: nowrap">' .
322 Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) .
323 '</span>' . ' ' .
324 Xml::submitButton( wfMsg( 'sp-contributions-submit' ) ) .
325 Xml::closeElement( 'p' );
326
327 $explain = wfMsgExt( 'sp-contributions-explain', 'parseinline' );
328 if( !wfEmptyMsg( 'sp-contributions-explain', $explain ) )
329 $f .= "<p>{$explain}</p>";
330
331 $f .= '</fieldset>' .
332 Xml::closeElement( 'form' );
333 return $f;
334 }
335
336 /**
337 * Output a subscription feed listing recent edits to this page.
338 * @param string $type
339 */
340 protected function feed( $type ) {
341 global $wgRequest, $wgFeed, $wgFeedClasses, $wgFeedLimit;
342
343 if( !$wgFeed ) {
344 global $wgOut;
345 $wgOut->addWikiMsg( 'feed-unavailable' );
346 return;
347 }
348
349 if( !isset( $wgFeedClasses[$type] ) ) {
350 global $wgOut;
351 $wgOut->addWikiMsg( 'feed-invalid' );
352 return;
353 }
354
355 $feed = new $wgFeedClasses[$type](
356 $this->feedTitle(),
357 wfMsgExt( 'tagline', 'parsemag' ),
358 $this->getTitle()->getFullUrl() . "/" . urlencode($this->opts['target'])
359 );
360
361 // Already valid title
362 $nt = Title::makeTitleSafe( NS_USER, $this->opts['target'] );
363 $target = $this->opts['target'] == 'newbies' ? 'newbies' : $nt->getText();
364
365 $pager = new ContribsPager( $target, $this->opts['namespace'],
366 $this->opts['year'], $this->opts['month'], $this->opts['tagfilter'] );
367
368 $pager->mLimit = min( $this->opts['limit'], $wgFeedLimit );
369
370 $feed->outHeader();
371 if( $pager->getNumRows() > 0 ) {
372 while( $row = $pager->mResult->fetchObject() ) {
373 $feed->outItem( $this->feedItem( $row ) );
374 }
375 }
376 $feed->outFooter();
377 }
378
379 protected function feedTitle() {
380 global $wgContLanguageCode, $wgSitename;
381 $page = SpecialPage::getPage( 'Contributions' );
382 $desc = $page->getDescription();
383 return "$wgSitename - $desc [$wgContLanguageCode]";
384 }
385
386 protected function feedItem( $row ) {
387 $title = Title::MakeTitle( intval( $row->page_namespace ), $row->page_title );
388 if( $title ) {
389 $date = $row->rev_timestamp;
390 $comments = $title->getTalkPage()->getFullURL();
391 $revision = Revision::newFromTitle( $title, $row->rev_id );
392
393 return new FeedItem(
394 $title->getPrefixedText(),
395 $this->feedItemDesc( $revision ),
396 $title->getFullURL(),
397 $date,
398 $this->feedItemAuthor( $revision ),
399 $comments
400 );
401 } else {
402 return NULL;
403 }
404 }
405
406 protected function feedItemAuthor( $revision ) {
407 return $revision->getUserText();
408 }
409
410 protected function feedItemDesc( $revision ) {
411 if( $revision ) {
412 return '<p>' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) .
413 htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
414 "</p>\n<hr />\n<div>" .
415 nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
416 }
417 return '';
418 }
419 }
420
421 /**
422 * Pager for Special:Contributions
423 * @ingroup SpecialPage Pager
424 */
425 class ContribsPager extends ReverseChronologicalPager {
426 public $mDefaultDirection = true;
427 var $messages, $target;
428 var $namespace = '', $mDb;
429
430 function __construct( $target, $namespace = false, $year = false, $month = false, $tagFilter = false ) {
431 parent::__construct();
432
433 $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
434
435 foreach( $msgs as $msg ) {
436 $this->messages[$msg] = wfMsgExt( $msg, 'escapenoentities' );
437 }
438
439 $this->target = $target;
440 $this->namespace = $namespace;
441 $this->tagFilter = $tagFilter;
442
443 $this->getDateCond( $year, $month );
444
445 $this->mDb = wfGetDB( DB_SLAVE, 'contributions' );
446 }
447
448 function getDefaultQuery() {
449 $query = parent::getDefaultQuery();
450 $query['target'] = $this->target;
451 return $query;
452 }
453
454 function getQueryInfo() {
455 global $wgUser;
456 list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
457
458 $conds = array_merge( $userCond, $this->getNamespaceCond() );
459 // Paranoia: avoid brute force searches (bug 17342)
460 if( !$wgUser->isAllowed( 'deleterevision' ) ) {
461 $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0';
462 } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
463 $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) .
464 ' != ' . Revision::SUPPRESSED_USER;
465 }
466 $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
467
468 $queryInfo = array(
469 'tables' => $tables,
470 'fields' => array(
471 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect',
472 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
473 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted'
474 ),
475 'conds' => $conds,
476 'options' => array( 'USE INDEX' => array('revision' => $index) ),
477 'join_conds' => $join_cond
478 );
479
480 ChangeTags::modifyDisplayQuery(
481 $queryInfo['tables'],
482 $queryInfo['fields'],
483 $queryInfo['conds'],
484 $queryInfo['join_conds'],
485 $queryInfo['options'],
486 $this->tagFilter
487 );
488
489 wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
490 return $queryInfo;
491 }
492
493 function getUserCond() {
494 $condition = array();
495 $join_conds = array();
496 if( $this->target == 'newbies' ) {
497 $tables = array( 'user_groups', 'page', 'revision' );
498 $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
499 $condition[] = 'rev_user >' . (int)($max - $max / 100);
500 $condition[] = 'ug_group IS NULL';
501 $index = 'user_timestamp';
502 # FIXME: other groups may have 'bot' rights
503 $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" );
504 } else {
505 $tables = array( 'page', 'revision' );
506 $condition['rev_user_text'] = $this->target;
507 $index = 'usertext_timestamp';
508 }
509 return array( $tables, $index, $condition, $join_conds );
510 }
511
512 function getNamespaceCond() {
513 if( $this->namespace !== '' ) {
514 return array( 'page_namespace' => (int)$this->namespace );
515 } else {
516 return array();
517 }
518 }
519
520 function getIndexField() {
521 return 'rev_timestamp';
522 }
523
524 function getStartBody() {
525 return "<ul>\n";
526 }
527
528 function getEndBody() {
529 return "</ul>\n";
530 }
531
532 /**
533 * Generates each row in the contributions list.
534 *
535 * Contributions which are marked "top" are currently on top of the history.
536 * For these contributions, a [rollback] link is shown for users with roll-
537 * back privileges. The rollback link restores the most recent version that
538 * was not written by the target user.
539 *
540 * @todo This would probably look a lot nicer in a table.
541 */
542 function formatRow( $row ) {
543 global $wgUser, $wgLang, $wgContLang;
544 wfProfileIn( __METHOD__ );
545
546 $sk = $this->getSkin();
547 $rev = new Revision( $row );
548 $classes = array();
549
550 $page = Title::newFromRow( $row );
551 $page->resetArticleId( $row->rev_page ); // use process cache
552 $link = $sk->link(
553 $page,
554 htmlspecialchars( $page->getPrefixedText() ),
555 array(),
556 $page->isRedirect() ? array( 'redirect' => 'no' ) : array()
557 );
558 # Mark current revisions
559 $difftext = $topmarktext = '';
560 if( $row->rev_id == $row->page_latest ) {
561 $topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
562 if( !$row->page_is_new ) {
563 $difflink = $sk->linkKnown(
564 $page,
565 $this->messages['diff'],
566 array(),
567 array( 'diff' => 0 )
568 );
569 $difftext .= wfMsg( 'parentheses', $difflink );
570 # Add rollback link
571 if( $page->quickUserCan( 'rollback') && $page->quickUserCan( 'edit' ) ) {
572 $topmarktext .= ' '.$sk->generateRollback( $rev );
573 }
574 } else {
575 $difftext .= $this->messages['newarticle'];
576 }
577 }
578 # Is there a visible previous revision?
579 if( !$rev->isDeleted(Revision::DELETED_TEXT) ) {
580 $difftext = $this->messages['pipe-separator'] . $sk->linkKnown(
581 $page,
582 $this->messages['diff'],
583 array(),
584 array(
585 'diff' => 'prev',
586 'oldid' => $row->rev_id
587 )
588 ) . ')';
589 } else {
590 $difftext = $this->messages['pipe-separator'] . $this->messages['diff'] . ')';
591 }
592 $histlink = '('.$sk->linkKnown(
593 $page,
594 $this->messages['hist'],
595 array(),
596 array( 'action' => 'history' )
597 );
598
599 $comment = $wgContLang->getDirMark() . $sk->revComment( $rev, false, true );
600 $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
601 if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
602 $d = '<span class="history-deleted">' . $date . '</span>';
603 } else {
604 $d = $sk->linkKnown(
605 $page,
606 htmlspecialchars($date),
607 array(),
608 array( 'oldid' => intval( $row->rev_id ) )
609 );
610 }
611
612 if( $this->target == 'newbies' ) {
613 $userlink = ' . . ' . $sk->userLink( $row->rev_user, $row->rev_user_text );
614 $userlink .= ' ' . wfMsgExt( 'parentheses', 'escapenoentities', $sk->userTalkLink( $row->rev_user, $row->rev_user_text ) ) . ' ';
615 } else {
616 $userlink = '';
617 }
618
619 if( $rev->getParentId() === 0 ) {
620 $nflag = ChangesList::flag( 'newpage' );
621 } else {
622 $nflag = '';
623 }
624
625 if( $rev->isMinor() ) {
626 $mflag = ChangesList::flag( 'minor' );
627 } else {
628 $mflag = '';
629 }
630
631 if( $wgUser->isAllowed( 'deleterevision' ) ) {
632 // If revision was hidden from sysops
633 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
634 $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
635 wfMsg( 'parentheses', $this->messages['rev-delundel'] ) ) . ' ';
636 // Otherwise, show the link...
637 } else {
638 $query = array(
639 'type' => 'revision',
640 'target' => $page->getPrefixedDbkey(),
641 'ids' => $rev->getId() );
642 $del = $this->mSkin->revDeleteLink( $query,
643 $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) . ' ';
644 }
645 } else {
646 $del = '';
647 }
648
649 $ret = "{$del}{$d} {$histlink} {$difftext} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
650
651 # Denote if username is redacted for this edit
652 if( $rev->getVisibility() & Revision::DELETED_USER ) {
653 $ret .= " <strong>" . wfMsgHtml('rev-deleted-user') . "</strong>";
654 }
655
656 # Tags, if any.
657 list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions' );
658 $classes = array_merge( $classes, $newClasses );
659 $ret .= " $tagSummary";
660
661 // Let extensions add data
662 wfRunHooks( 'ContributionsLineEnding', array( &$this, &$ret, $row ) );
663
664 $classes = implode( ' ', $classes );
665 $ret = "<li class=\"$classes\">$ret</li>\n";
666 wfProfileOut( __METHOD__ );
667 return $ret;
668 }
669
670 /**
671 * Get the Database object in use
672 *
673 * @return Database
674 */
675 public function getDatabase() {
676 return $this->mDb;
677 }
678
679 }