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