3 * Implements Special:Contributions
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup SpecialPage
25 * Special:Contributions, show user contributions in a paged list
27 * @ingroup SpecialPage
30 class SpecialContributions
extends SpecialPage
{
34 public function __construct() {
35 parent
::__construct( 'Contributions' );
38 public function execute( $par ) {
39 global $wgUser, $wgOut, $wgRequest;
42 $this->outputHeader();
43 $wgOut->addModuleStyles( 'mediawiki.special' );
45 $this->opts
= array();
47 if( $par == 'newbies' ) {
49 $this->opts
['contribs'] = 'newbie';
50 } elseif( isset( $par ) ) {
53 $target = $wgRequest->getVal( 'target' );
57 if( $wgRequest->getVal( 'contribs' ) == 'newbie' ) {
59 $this->opts
['contribs'] = 'newbie';
62 $this->opts
['deletedOnly'] = $wgRequest->getBool( 'deletedOnly' );
64 if( !strlen( $target ) ) {
65 $wgOut->addHTML( $this->getForm() );
69 $this->opts
['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
70 $this->opts
['target'] = $target;
71 $this->opts
['topOnly'] = $wgRequest->getBool( 'topOnly' );
72 $this->opts
['showSizeDiff'] = $wgRequest->getBool( 'showSizeDiff' );
74 $nt = Title
::makeTitleSafe( NS_USER
, $target );
76 $wgOut->addHTML( $this->getForm() );
79 $id = User
::idFromName( $nt->getText() );
81 if( $target != 'newbies' ) {
82 $target = $nt->getText();
83 $wgOut->setSubtitle( $this->contributionsSub( $nt, $id ) );
84 $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) );
85 $user = User
::newFromName( $target, false );
86 if ( is_object($user) ) {
87 $wgUser->getSkin()->setRelevantUser( $user );
90 $wgOut->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') );
91 $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'sp-contributions-newbies-title' ) ) );
94 if( ( $ns = $wgRequest->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
95 $this->opts
['namespace'] = intval( $ns );
97 $this->opts
['namespace'] = '';
100 $this->opts
['tagFilter'] = (string) $wgRequest->getVal( 'tagFilter' );
102 // Allows reverts to have the bot flag in recent changes. It is just here to
103 // be passed in the form at the top of the page
104 if( $wgUser->isAllowed( 'markbotedits' ) && $wgRequest->getBool( 'bot' ) ) {
105 $this->opts
['bot'] = '1';
108 $skip = $wgRequest->getText( 'offset' ) ||
$wgRequest->getText( 'dir' ) == 'prev';
109 # Offset overrides year/month selection
111 $this->opts
['year'] = '';
112 $this->opts
['month'] = '';
114 $this->opts
['year'] = $wgRequest->getIntOrNull( 'year' );
115 $this->opts
['month'] = $wgRequest->getIntOrNull( 'month' );
118 // Add RSS/atom links
119 $this->setSyndicated();
120 $feedType = $wgRequest->getVal( 'feed' );
122 return $this->feed( $feedType );
125 if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) {
127 $wgOut->addHTML( $this->getForm() );
129 $pager = new ContribsPager( array(
131 'namespace' => $this->opts
['namespace'],
132 'year' => $this->opts
['year'],
133 'month' => $this->opts
['month'],
134 'deletedOnly' => $this->opts
['deletedOnly'],
135 'topOnly' => $this->opts
['topOnly'],
136 'showSizeDiff' => $this->opts
['showSizeDiff'],
138 if( !$pager->getNumRows() ) {
139 $wgOut->addWikiMsg( 'nocontribs', $target );
141 # Show a message about slave lag, if applicable
142 if( ( $lag = $pager->getDatabase()->getLag() ) > 0 )
143 $wgOut->showLagWarning( $lag );
146 '<p>' . $pager->getNavigationBar() . '</p>' .
148 '<p>' . $pager->getNavigationBar() . '</p>'
151 $wgOut->preventClickjacking( $pager->getPreventClickjacking() );
154 # Show the appropriate "footer" message - WHOIS tools, etc.
155 if( $target != 'newbies' ) {
156 $message = 'sp-contributions-footer';
157 if ( IP
::isIPAddress( $target ) ) {
158 $message = 'sp-contributions-footer-anon';
160 $user = User
::newFromName( $target );
161 if ( !$user ||
$user->isAnon() ) {
162 // No message for non-existing users
167 if( !wfMessage( $message, $target )->isDisabled() ) {
169 "<div class='mw-contributions-footer'>\n$1\n</div>",
170 array( $message, $target ) );
176 protected function setSyndicated() {
178 $wgOut->setSyndicated( true );
179 $wgOut->setFeedAppendQuery( wfArrayToCGI( $this->opts
) );
183 * Generates the subheading with links
184 * @param $nt Title object for the target
185 * @param $id Integer: User ID for the target
186 * @return String: appropriately-escaped HTML to be output literally
187 * @todo Fixme: almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
189 protected function contributionsSub( $nt, $id ) {
190 global $wgLang, $wgUser, $wgOut;
192 $sk = $wgUser->getSkin();
194 if ( $id === null ) {
195 $user = htmlspecialchars( $nt->getText() );
197 $user = $sk->link( $nt, htmlspecialchars( $nt->getText() ) );
199 $userObj = User
::newFromName( $nt->getText(), /* check for username validity not needed */ false );
200 $talk = $nt->getTalkPage();
202 $tools = self
::getUserLinks( $nt, $talk, $userObj, $wgUser );
203 $links = $wgLang->pipeList( $tools );
205 // Show a note if the user is blocked and display the last block log entry.
206 if ( $userObj->isBlocked() ) {
207 LogEventsList
::showLogExtract(
210 $nt->getPrefixedText(),
214 'showIfEmpty' => false,
217 'sp-contributions-blocked-notice-anon' :
218 'sp-contributions-blocked-notice',
219 $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice'
221 'offset' => '' # don't use $wgRequest parameter offset
227 // Old message 'contribsub' had one parameter, but that doesn't work for
228 // languages that want to put the "for" bit right after $user but before
229 // $links. If 'contribsub' is around, use it for reverse compatibility,
230 // otherwise use 'contribsub2'.
231 if( wfEmptyMsg( 'contribsub' ) ) {
232 return wfMsgHtml( 'contribsub2', $user, $links );
234 return wfMsgHtml( 'contribsub', "$user ($links)" );
239 * Links to different places.
240 * @param $userpage Title: Target user page
241 * @param $talkpage Title: Talk page
242 * @param $target User: Target user object
243 * @param $subject User: The viewing user ($wgUser is still checked in some cases, like userrights page!!)
245 public static function getUserLinks( Title
$userpage, Title
$talkpage, User
$target, User
$subject ) {
247 $sk = $subject->getSkin();
248 $id = $target->getId();
249 $username = $target->getName();
251 $tools[] = $sk->link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) );
253 if( ( $id !== null ) ||
( $id === null && IP
::isIPAddress( $username ) ) ) {
254 if( $subject->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
255 if ( $target->isBlocked() ) {
256 $tools[] = $sk->linkKnown( # Change block link
257 SpecialPage
::getTitleFor( 'Block', $username ),
258 wfMsgHtml( 'change-blocklink' )
260 $tools[] = $sk->linkKnown( # Unblock link
261 SpecialPage
::getTitleFor( 'Unblock', $username ),
262 wfMsgHtml( 'unblocklink' )
264 } else { # User is not blocked
265 $tools[] = $sk->linkKnown( # Block link
266 SpecialPage
::getTitleFor( 'Block', $username ),
267 wfMsgHtml( 'blocklink' )
272 $tools[] = $sk->linkKnown(
273 SpecialPage
::getTitleFor( 'Log' ),
274 wfMsgHtml( 'sp-contributions-blocklog' ),
278 'page' => $userpage->getPrefixedText()
283 $tools[] = $sk->linkKnown(
284 SpecialPage
::getTitleFor( 'Listfiles', $username ),
285 wfMsgHtml( 'sp-contributions-uploads' )
289 $tools[] = $sk->linkKnown(
290 SpecialPage
::getTitleFor( 'Log' ),
291 wfMsgHtml( 'sp-contributions-logs' ),
293 array( 'user' => $username )
296 # Add link to deleted user contributions for priviledged users
297 if( $subject->isAllowed( 'deletedhistory' ) ) {
298 $tools[] = $sk->linkKnown(
299 SpecialPage
::getTitleFor( 'DeletedContributions', $username ),
300 wfMsgHtml( 'sp-contributions-deleted' )
304 # Add a link to change user rights for privileged users
305 $userrightsPage = new UserrightsPage();
306 if( $id !== null && $userrightsPage->userCanChangeRights( $target ) ) {
307 $tools[] = $sk->linkKnown(
308 SpecialPage
::getTitleFor( 'Userrights', $username ),
309 wfMsgHtml( 'sp-contributions-userrights' )
313 wfRunHooks( 'ContributionsToolLinks', array( $id, $userpage, &$tools ) );
318 * Generates the namespace selector form with hidden attributes.
319 * @return String: HTML fragment
321 protected function getForm() {
322 global $wgScript, $wgMiserMode, $wgRCMaxAge, $wgContLang;
324 $this->opts
['title'] = $this->getTitle()->getPrefixedText();
325 if( !isset( $this->opts
['target'] ) ) {
326 $this->opts
['target'] = '';
328 $this->opts
['target'] = str_replace( '_' , ' ' , $this->opts
['target'] );
331 if( !isset( $this->opts
['namespace'] ) ) {
332 $this->opts
['namespace'] = '';
335 if( !isset( $this->opts
['contribs'] ) ) {
336 $this->opts
['contribs'] = 'user';
339 if( !isset( $this->opts
['year'] ) ) {
340 $this->opts
['year'] = '';
343 if( !isset( $this->opts
['month'] ) ) {
344 $this->opts
['month'] = '';
347 if( $this->opts
['contribs'] == 'newbie' ) {
348 $this->opts
['target'] = '';
351 if( !isset( $this->opts
['tagFilter'] ) ) {
352 $this->opts
['tagFilter'] = '';
355 if( !isset( $this->opts
['topOnly'] ) ) {
356 $this->opts
['topOnly'] = false;
359 if( !isset( $this->opts
['showSizeDiff'] ) ) {
360 $this->opts
['showSizeDiff'] = !$wgMiserMode;
363 $f = Xml
::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) );
365 # Add hidden params for tracking except for parameters in $skipParameters
366 $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'showSizeDiff' );
367 foreach ( $this->opts
as $name => $value ) {
368 if( in_array( $name, $skipParameters ) ) {
371 $f .= "\t" . Html
::hidden( $name, $value ) . "\n";
374 $tagFilter = ChangeTags
::buildTagFilterSelector( $this->opts
['tagFilter'] );
378 if ( !$wgMiserMode ) {
379 $fNS = Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
380 Xml
::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' .
381 Xml
::namespaceSelector( $this->opts
['namespace'], '' )
383 $fShowDiff = Xml
::infoBox(
384 Xml
::checkLabel( wfMsg( 'sp-contributions-showsizediff' ), 'showSizeDiff', 'mw-show-size-diff', $this->opts
['showSizeDiff'] ) . '<br />'.
385 wfMsgReplaceArgs ( wfMsg( 'sp-contributions-showsizediff-warn' ), array( $wgContLang->formatTimePeriod( $wgRCMaxAge ) ) )
386 , 'warning-32.png', wfMsg( 'sp-contributions-showsizediff' )
390 $f .= Xml
::fieldset( wfMsg( 'sp-contributions-search' ) ) .
391 Xml
::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parsemag' ) ),
392 'contribs', 'newbie' , 'newbie', $this->opts
['contribs'] == 'newbie' ) . '<br />' .
393 Xml
::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parsemag' ) ),
394 'contribs' , 'user', 'user', $this->opts
['contribs'] == 'user' ) . ' ' .
395 Html
::input( 'target', $this->opts
['target'], 'text', array(
398 ) +
( $this->opts
['target'] ?
array() : array( 'autofocus' ) ) ) . ' '.
400 Xml
::checkLabel( wfMsg( 'history-show-deleted' ),
401 'deletedOnly', 'mw-show-deleted-only', $this->opts
['deletedOnly'] ) . '<br />' .
402 Xml
::tags( 'p', null, Xml
::checkLabel( wfMsg( 'sp-contributions-toponly' ),
403 'topOnly', 'mw-show-top-only', $this->opts
['topOnly'] ) ) .
405 ( $tagFilter ? Xml
::tags( 'p', null, implode( ' ', $tagFilter ) ) : '' ) .
406 Html
::rawElement( 'p', array( 'style' => 'white-space: nowrap' ),
407 Xml
::dateMenu( $this->opts
['year'], $this->opts
['month'] ) . ' ' .
408 Xml
::submitButton( wfMsg( 'sp-contributions-submit' ) )
410 $explain = wfMsgExt( 'sp-contributions-explain', 'parseinline' );
411 if( !wfEmptyMsg( 'sp-contributions-explain' ) ) {
412 $f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
414 $f .= Xml
::closeElement('fieldset' ) .
415 Xml
::closeElement( 'form' );
420 * Output a subscription feed listing recent edits to this page.
421 * @param $type String
423 protected function feed( $type ) {
424 global $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgOut;
427 $wgOut->addWikiMsg( 'feed-unavailable' );
431 if( !isset( $wgFeedClasses[$type] ) ) {
432 $wgOut->addWikiMsg( 'feed-invalid' );
436 $feed = new $wgFeedClasses[$type](
438 wfMsgExt( 'tagline', 'parsemag' ),
439 $this->getTitle()->getFullUrl() . "/" . urlencode($this->opts
['target'])
442 // Already valid title
443 $nt = Title
::makeTitleSafe( NS_USER
, $this->opts
['target'] );
444 $target = $this->opts
['target'] == 'newbies' ?
'newbies' : $nt->getText();
446 $pager = new ContribsPager( array(
448 'namespace' => $this->opts
['namespace'],
449 'year' => $this->opts
['year'],
450 'month' => $this->opts
['month'],
451 'tagFilter' => $this->opts
['tagFilter'],
452 'deletedOnly' => $this->opts
['deletedOnly'],
453 'topOnly' => $this->opts
['topOnly'],
454 'showSizeDiff' => $this->opts
['showSizeDiff'],
457 $pager->mLimit
= min( $this->opts
['limit'], $wgFeedLimit );
460 if( $pager->getNumRows() > 0 ) {
461 foreach ( $pager->mResult
as $row ) {
462 $feed->outItem( $this->feedItem( $row ) );
468 protected function feedTitle() {
469 global $wgLanguageCode, $wgSitename;
470 $desc = $this->getDescription();
471 return "$wgSitename - $desc [$wgLanguageCode]";
474 protected function feedItem( $row ) {
475 $title = Title
::MakeTitle( intval( $row->page_namespace
), $row->page_title
);
477 $date = $row->rev_timestamp
;
478 $comments = $title->getTalkPage()->getFullURL();
479 $revision = Revision
::newFromTitle( $title, $row->rev_id
);
482 $title->getPrefixedText(),
483 $this->feedItemDesc( $revision ),
484 $title->getFullURL(),
486 $this->feedItemAuthor( $revision ),
495 * @param $revision Revision
498 protected function feedItemAuthor( $revision ) {
499 return $revision->getUserText();
503 * @param $revision Revision
506 protected function feedItemDesc( $revision ) {
508 return '<p>' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) .
509 htmlspecialchars( FeedItem
::stripComment( $revision->getComment() ) ) .
510 "</p>\n<hr />\n<div>" .
511 nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
518 * Pager for Special:Contributions
519 * @ingroup SpecialPage Pager
521 class ContribsPager
extends ReverseChronologicalPager
{
522 public $mDefaultDirection = true;
523 var $messages, $target;
524 var $namespace = '', $mDb;
525 var $preventClickjacking = false;
527 function __construct( $options ) {
528 parent
::__construct();
530 $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
532 foreach( $msgs as $msg ) {
533 $this->messages
[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
536 $this->target
= isset( $options['target'] ) ?
$options['target'] : '';
537 $this->namespace = isset( $options['namespace'] ) ?
$options['namespace'] : '';
538 $this->tagFilter
= isset( $options['tagFilter'] ) ?
$options['tagFilter'] : false;
540 $this->deletedOnly
= !empty( $options['deletedOnly'] );
541 $this->topOnly
= !empty( $options['topOnly'] );
542 $this->showSizeDiff
= !empty( $options['showSizeDiff'] );
544 $year = isset( $options['year'] ) ?
$options['year'] : false;
545 $month = isset( $options['month'] ) ?
$options['month'] : false;
546 $this->getDateCond( $year, $month );
548 $this->mDb
= wfGetDB( DB_SLAVE
, 'contributions' );
551 function getDefaultQuery() {
552 $query = parent
::getDefaultQuery();
553 $query['target'] = $this->target
;
557 function getQueryInfo() {
558 global $wgUser, $wgMiserMode;
559 list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
561 $conds = array_merge( $userCond, $this->getNamespaceCond() );
562 // Paranoia: avoid brute force searches (bug 17342)
563 if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
564 $conds[] = $this->mDb
->bitAnd('rev_deleted',Revision
::DELETED_USER
) . ' = 0';
565 } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
566 $conds[] = $this->mDb
->bitAnd('rev_deleted',Revision
::SUPPRESSED_USER
) .
567 ' != ' . Revision
::SUPPRESSED_USER
;
569 $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
572 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect',
573 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
574 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted',
577 if ( $this->showSizeDiff
&& !$wgMiserMode ) {
578 $fields = array_merge( $fields, array( 'rc_old_len', 'rc_new_len' ) );
579 array_unshift( $tables, 'recentchanges' );
580 $join_cond['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid" );
587 'options' => array( 'USE INDEX' => array('revision' => $index) ),
588 'join_conds' => $join_cond
590 ChangeTags
::modifyDisplayQuery(
591 $queryInfo['tables'],
592 $queryInfo['fields'],
594 $queryInfo['join_conds'],
595 $queryInfo['options'],
599 wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
603 function getUserCond() {
604 $condition = array();
605 $join_conds = array();
607 if( $this->target
== 'newbies' ) {
608 $tables = array( 'user_groups', 'page', 'revision' );
609 $max = $this->mDb
->selectField( 'user', 'max(user_id)', false, __METHOD__
);
610 $condition[] = 'rev_user >' . (int)($max - $max / 100);
611 $condition[] = 'ug_group IS NULL';
612 $index = 'user_timestamp';
613 # FIXME: other groups may have 'bot' rights
614 $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" );
616 $tables = array( 'page', 'revision' );
617 $condition['rev_user_text'] = $this->target
;
618 $index = 'usertext_timestamp';
620 if( $this->deletedOnly
) {
621 $condition[] = "rev_deleted != '0'";
623 if( $this->topOnly
) {
624 $condition[] = "rev_id = page_latest";
626 return array( $tables, $index, $condition, $join_conds );
629 function getNamespaceCond() {
631 if( $this->namespace !== '' && !$wgMiserMode ) {
632 return array( 'page_namespace' => (int)$this->namespace );
638 function getIndexField() {
639 return 'rev_timestamp';
642 function getStartBody() {
646 function getEndBody() {
651 * Generates each row in the contributions list.
653 * Contributions which are marked "top" are currently on top of the history.
654 * For these contributions, a [rollback] link is shown for users with roll-
655 * back privileges. The rollback link restores the most recent version that
656 * was not written by the target user.
658 * @todo This would probably look a lot nicer in a table.
660 function formatRow( $row ) {
661 global $wgUser, $wgLang, $wgContLang;
662 wfProfileIn( __METHOD__
);
664 $sk = $this->getSkin();
665 $rev = new Revision( $row );
668 $page = Title
::newFromRow( $row );
671 htmlspecialchars( $page->getPrefixedText() ),
673 $page->isRedirect() ?
array( 'redirect' => 'no' ) : array()
675 # Mark current revisions
677 if( $row->rev_id
== $row->page_latest
) {
678 $topmarktext .= '<span class="mw-uctop">' . $this->messages
['uctop'] . '</span>';
680 if( !$row->page_is_new
&& $page->quickUserCan( 'rollback' )
681 && $page->quickUserCan( 'edit' ) )
683 $this->preventClickjacking();
684 $topmarktext .= ' '.$sk->generateRollback( $rev );
687 # Is there a visible previous revision?
688 if( $rev->userCan( Revision
::DELETED_TEXT
) && $rev->getParentId() !== 0 ) {
689 $difftext = $sk->linkKnown(
691 $this->messages
['diff'],
695 'oldid' => $row->rev_id
699 $difftext = $this->messages
['diff'];
701 $histlink = $sk->linkKnown(
703 $this->messages
['hist'],
705 array( 'action' => 'history' )
708 $comment = $wgContLang->getDirMark() . $sk->revComment( $rev, false, true );
709 $date = $wgLang->timeanddate( wfTimestamp( TS_MW
, $row->rev_timestamp
), true );
710 if( $rev->userCan( Revision
::DELETED_TEXT
) ) {
713 htmlspecialchars($date),
715 array( 'oldid' => intval( $row->rev_id
) )
718 $d = htmlspecialchars( $date );
720 if( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
721 $d = '<span class="history-deleted">' . $d . '</span>';
724 if( $this->target
== 'newbies' ) {
725 $userlink = ' . . ' . $sk->userLink( $row->rev_user
, $row->rev_user_text
);
726 $userlink .= ' ' . wfMsg( 'parentheses', $sk->userTalkLink( $row->rev_user
, $row->rev_user_text
) ) . ' ';
731 if( $rev->getParentId() === 0 ) {
732 $nflag = ChangesList
::flag( 'newpage' );
737 if( $rev->isMinor() ) {
738 $mflag = ChangesList
::flag( 'minor' );
743 // Don't show useless link to people who cannot hide revisions
744 $canHide = $wgUser->isAllowed( 'deleterevision' );
745 if( $canHide ||
($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
746 if( !$rev->userCan( Revision
::DELETED_RESTRICTED
) ) {
747 $del = $this->mSkin
->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
750 'type' => 'revision',
751 'target' => $page->getPrefixedDbkey(),
752 'ids' => $rev->getId()
754 $del = $this->mSkin
->revDeleteLink( $query,
755 $rev->isDeleted( Revision
::DELETED_RESTRICTED
), $canHide );
762 $diffHistLinks = '(' . $difftext . $this->messages
['pipe-separator'] . $histlink . ')';
765 $diffOut = ( $this->showSizeDiff
) ?
' . . '.ChangesList
::showCharacterDifference( $row->rc_old_len
, $row->rc_new_len
) : ' . . '.Linker
::formatRevisionSize( $row->rev_len
);
767 $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}";
769 # Denote if username is redacted for this edit
770 if( $rev->isDeleted( Revision
::DELETED_USER
) ) {
771 $ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
775 list($tagSummary, $newClasses) = ChangeTags
::formatSummaryRow( $row->ts_tags
, 'contributions' );
776 $classes = array_merge( $classes, $newClasses );
777 $ret .= " $tagSummary";
779 // Let extensions add data
780 wfRunHooks( 'ContributionsLineEnding', array( &$this, &$ret, $row ) );
782 $classes = implode( ' ', $classes );
783 $ret = "<li class=\"$classes\">$ret</li>\n";
784 wfProfileOut( __METHOD__
);
789 * Get the Database object in use
791 * @return DatabaseBase
793 public function getDatabase() {
798 * Overwrite Pager function and return a helpful comment
800 function getSqlComment() {
801 if ( $this->namespace ||
$this->deletedOnly
) {
802 return 'contributions page filtered for namespace or RevisionDeleted edits'; // potentially slow, see CR r58153
804 return 'contributions page unfiltered';
808 protected function preventClickjacking() {
809 $this->preventClickjacking
= true;
812 public function getPreventClickjacking() {
813 return $this->preventClickjacking
;