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