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 ) {
40 $this->outputHeader();
41 $out = $this->getOutput();
42 $out->addModuleStyles( 'mediawiki.special' );
44 $this->opts
= array();
45 $request = $this->getRequest();
47 if ( $par == 'newbies' ) {
49 $this->opts
['contribs'] = 'newbie';
50 } elseif ( $par !== null ) {
53 $target = $request->getVal( 'target' );
57 if ( $request->getVal( 'contribs' ) == 'newbie' ) {
59 $this->opts
['contribs'] = 'newbie';
61 $this->opts
['contribs'] = 'user';
64 $this->opts
['deletedOnly'] = $request->getBool( 'deletedOnly' );
66 if ( !strlen( $target ) ) {
67 $out->addHTML( $this->getForm() );
71 $user = $this->getUser();
73 $this->opts
['limit'] = $request->getInt( 'limit', $user->getOption( 'rclimit' ) );
74 $this->opts
['target'] = $target;
75 $this->opts
['topOnly'] = $request->getBool( 'topOnly' );
77 $userObj = User
::newFromName( $target, false );
79 $out->addHTML( $this->getForm() );
82 $nt = $userObj->getUserPage();
83 $id = $userObj->getID();
85 if ( $this->opts
['contribs'] != 'newbie' ) {
86 $target = $nt->getText();
87 $out->addSubtitle( $this->contributionsSub( $userObj ) );
88 $out->setHTMLTitle( $this->msg( 'pagetitle', $this->msg( 'contributions-title', $target )->plain() ) );
89 $this->getSkin()->setRelevantUser( $userObj );
91 $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
92 $out->setHTMLTitle( $this->msg( 'pagetitle', $this->msg( 'sp-contributions-newbies-title' )->plain() ) );
95 if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
96 $this->opts
['namespace'] = intval( $ns );
98 $this->opts
['namespace'] = '';
101 $this->opts
['associated'] = $request->getBool( 'associated' );
103 $this->opts
['nsInvert'] = (bool) $request->getVal( 'nsInvert' );
105 $this->opts
['tagfilter'] = (string) $request->getVal( 'tagfilter' );
107 // Allows reverts to have the bot flag in recent changes. It is just here to
108 // be passed in the form at the top of the page
109 if ( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
110 $this->opts
['bot'] = '1';
113 $skip = $request->getText( 'offset' ) ||
$request->getText( 'dir' ) == 'prev';
114 # Offset overrides year/month selection
116 $this->opts
['year'] = '';
117 $this->opts
['month'] = '';
119 $this->opts
['year'] = $request->getIntOrNull( 'year' );
120 $this->opts
['month'] = $request->getIntOrNull( 'month' );
123 $feedType = $request->getVal( 'feed' );
125 // Maintain some level of backwards compatability
126 // If people request feeds using the old parameters, redirect to API
128 'action' => 'feedcontributions',
129 'feedformat' => $feedType,
132 if ( $this->opts
['topOnly'] ) {
133 $apiParams['toponly'] = true;
135 if ( $this->opts
['deletedOnly'] ) {
136 $apiParams['deletedonly'] = true;
138 if ( $this->opts
['tagfilter'] !== '' ) {
139 $apiParams['tagfilter'] = $this->opts
['tagfilter'];
141 if ( $this->opts
['namespace'] !== '' ) {
142 $apiParams['namespace'] = $this->opts
['namespace'];
144 if ( $this->opts
['year'] !== null ) {
145 $apiParams['year'] = $this->opts
['year'];
147 if ( $this->opts
['month'] !== null ) {
148 $apiParams['month'] = $this->opts
['month'];
151 $url = wfScript( 'api' ) . '?' . wfArrayToCGI( $apiParams );
153 $out->redirect( $url, '301' );
157 // Add RSS/atom links
158 $this->addFeedLinks( array( 'action' => 'feedcontributions', 'user' => $target ) );
160 if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) {
162 $out->addHTML( $this->getForm() );
164 $pager = new ContribsPager( $this->getContext(), array(
166 'contribs' => $this->opts
['contribs'],
167 'namespace' => $this->opts
['namespace'],
168 'year' => $this->opts
['year'],
169 'month' => $this->opts
['month'],
170 'deletedOnly' => $this->opts
['deletedOnly'],
171 'topOnly' => $this->opts
['topOnly'],
172 'nsInvert' => $this->opts
['nsInvert'],
173 'associated' => $this->opts
['associated'],
175 if ( !$pager->getNumRows() ) {
176 $out->addWikiMsg( 'nocontribs', $target );
178 # Show a message about slave lag, if applicable
179 $lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
181 $out->showLagWarning( $lag );
184 '<p>' . $pager->getNavigationBar() . '</p>' .
186 '<p>' . $pager->getNavigationBar() . '</p>'
189 $out->preventClickjacking( $pager->getPreventClickjacking() );
191 # Show the appropriate "footer" message - WHOIS tools, etc.
192 if ( $this->opts
['contribs'] != 'newbie' ) {
193 $message = 'sp-contributions-footer';
194 if ( IP
::isIPAddress( $target ) ) {
195 $message = 'sp-contributions-footer-anon';
197 if ( $userObj->isAnon() ) {
198 // No message for non-existing users
203 if ( !$this->msg( $message, $target )->isDisabled() ) {
205 "<div class='mw-contributions-footer'>\n$1\n</div>",
206 array( $message, $target ) );
213 * Generates the subheading with links
214 * @param $userObj User object for the target
215 * @return String: appropriately-escaped HTML to be output literally
216 * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
218 protected function contributionsSub( $userObj ) {
219 if ( $userObj->isAnon() ) {
220 $user = htmlspecialchars( $userObj->getName() );
222 $user = Linker
::link( $userObj->getUserPage(), htmlspecialchars( $userObj->getName() ) );
224 $nt = $userObj->getUserPage();
225 $talk = $userObj->getTalkPage();
227 $tools = $this->getUserLinks( $nt, $talk, $userObj );
228 $links = $this->getLanguage()->pipeList( $tools );
230 // Show a note if the user is blocked and display the last block log entry.
231 if ( $userObj->isBlocked() ) {
232 $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
233 LogEventsList
::showLogExtract(
240 'showIfEmpty' => false,
243 'sp-contributions-blocked-notice-anon' :
244 'sp-contributions-blocked-notice',
245 $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
247 'offset' => '' # don't use WebRequest parameter offset
253 // Old message 'contribsub' had one parameter, but that doesn't work for
254 // languages that want to put the "for" bit right after $user but before
255 // $links. If 'contribsub' is around, use it for reverse compatibility,
256 // otherwise use 'contribsub2'.
257 $oldMsg = $this->msg( 'contribsub' );
258 if ( $oldMsg->exists() ) {
259 return $oldMsg->rawParams( "$user ($links)" );
261 return $this->msg( 'contribsub2' )->rawParams( $user, $links );
266 * Links to different places.
267 * @param $userpage Title: Target user page
268 * @param $talkpage Title: Talk page
269 * @param $target User: Target user object
272 public function getUserLinks( Title
$userpage, Title
$talkpage, User
$target ) {
274 $id = $target->getId();
275 $username = $target->getName();
277 $tools[] = Linker
::link( $talkpage, $this->msg( 'sp-contributions-talk' )->escaped() );
279 if ( ( $id !== null ) ||
( $id === null && IP
::isIPAddress( $username ) ) ) {
280 if ( $this->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
281 if ( $target->isBlocked() ) {
282 $tools[] = Linker
::linkKnown( # Change block link
283 SpecialPage
::getTitleFor( 'Block', $username ),
284 $this->msg( 'change-blocklink' )->escaped()
286 $tools[] = Linker
::linkKnown( # Unblock link
287 SpecialPage
::getTitleFor( 'Unblock', $username ),
288 $this->msg( 'unblocklink' )->escaped()
290 } else { # User is not blocked
291 $tools[] = Linker
::linkKnown( # Block link
292 SpecialPage
::getTitleFor( 'Block', $username ),
293 $this->msg( 'blocklink' )->escaped()
298 $tools[] = Linker
::linkKnown(
299 SpecialPage
::getTitleFor( 'Log', 'block' ),
300 $this->msg( 'sp-contributions-blocklog' )->escaped(),
303 'page' => $userpage->getPrefixedText()
308 $tools[] = Linker
::linkKnown(
309 SpecialPage
::getTitleFor( 'Listfiles', $username ),
310 $this->msg( 'sp-contributions-uploads' )->escaped()
314 $tools[] = Linker
::linkKnown(
315 SpecialPage
::getTitleFor( 'Log', $username ),
316 $this->msg( 'sp-contributions-logs' )->escaped()
319 # Add link to deleted user contributions for priviledged users
320 if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
321 $tools[] = Linker
::linkKnown(
322 SpecialPage
::getTitleFor( 'DeletedContributions', $username ),
323 $this->msg( 'sp-contributions-deleted' )->escaped()
327 # Add a link to change user rights for privileged users
328 $userrightsPage = new UserrightsPage();
329 $userrightsPage->setContext( $this->getContext() );
330 if ( $id !== null && $userrightsPage->userCanChangeRights( $target ) ) {
331 $tools[] = Linker
::linkKnown(
332 SpecialPage
::getTitleFor( 'Userrights', $username ),
333 $this->msg( 'sp-contributions-userrights' )->escaped()
337 wfRunHooks( 'ContributionsToolLinks', array( $id, $userpage, &$tools ) );
342 * Generates the namespace selector form with hidden attributes.
343 * @return String: HTML fragment
345 protected function getForm() {
348 $this->opts
['title'] = $this->getTitle()->getPrefixedText();
349 if ( !isset( $this->opts
['target'] ) ) {
350 $this->opts
['target'] = '';
352 $this->opts
['target'] = str_replace( '_' , ' ' , $this->opts
['target'] );
355 if ( !isset( $this->opts
['namespace'] ) ) {
356 $this->opts
['namespace'] = '';
359 if ( !isset( $this->opts
['nsInvert'] ) ) {
360 $this->opts
['nsInvert'] = '';
363 if ( !isset( $this->opts
['associated'] ) ) {
364 $this->opts
['associated'] = false;
367 if ( !isset( $this->opts
['contribs'] ) ) {
368 $this->opts
['contribs'] = 'user';
371 if ( !isset( $this->opts
['year'] ) ) {
372 $this->opts
['year'] = '';
375 if ( !isset( $this->opts
['month'] ) ) {
376 $this->opts
['month'] = '';
379 if ( $this->opts
['contribs'] == 'newbie' ) {
380 $this->opts
['target'] = '';
383 if ( !isset( $this->opts
['tagfilter'] ) ) {
384 $this->opts
['tagfilter'] = '';
387 if ( !isset( $this->opts
['topOnly'] ) ) {
388 $this->opts
['topOnly'] = false;
391 $form = Xml
::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) );
393 # Add hidden params for tracking except for parameters in $skipParameters
394 $skipParameters = array( 'namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated' );
395 foreach ( $this->opts
as $name => $value ) {
396 if ( in_array( $name, $skipParameters ) ) {
399 $form .= "\t" . Html
::hidden( $name, $value ) . "\n";
402 $tagFilter = ChangeTags
::buildTagFilterSelector( $this->opts
['tagfilter'] );
406 Xml
::tags( 'td', array( 'class' => 'mw-label' ), array_shift( $tagFilter ) ) .
407 Xml
::tags( 'td', array( 'class' => 'mw-input' ), implode( ' ', $tagFilter ) );
409 $filterSelection = Xml
::tags( 'td', array( 'colspan' => 2 ), '' );
412 $targetSelection = Xml
::tags( 'td', array( 'colspan' => 2 ),
414 $this->msg( 'sp-contributions-newbies' )->text(),
418 $this->opts
['contribs'] == 'newbie',
419 array( 'class' => 'mw-input' )
422 $this->msg( 'sp-contributions-username' )->text(),
426 $this->opts
['contribs'] == 'user',
427 array( 'class' => 'mw-input' )
431 $this->opts
['target'],
433 array( 'size' => '20', 'required' => '', 'class' => 'mw-input' ) +
434 ( $this->opts
['target'] ?
array() : array( 'autofocus' )
439 $namespaceSelection =
440 Xml
::tags( 'td', array( 'class' => 'mw-label' ),
442 $this->msg( 'namespace' )->text(),
447 Xml
::tags( 'td', null,
448 Xml
::namespaceSelector( $this->opts
['namespace'], '' ) . ' ' .
449 Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
451 $this->msg( 'invert' )->text(),
454 $this->opts
['nsInvert'],
455 array( 'title' => $this->msg( 'tooltip-invert' )->text(), 'class' => 'mw-input' )
458 Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
460 $this->msg( 'namespace_association' )->text(),
463 $this->opts
['associated'],
464 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text(), 'class' => 'mw-input' )
469 $extraOptions = Xml
::tags( 'td', array( 'colspan' => 2 ),
470 Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
472 $this->msg( 'history-show-deleted' )->text(),
474 'mw-show-deleted-only',
475 $this->opts
['deletedOnly'],
476 array( 'class' => 'mw-input' )
479 Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
481 $this->msg( 'sp-contributions-toponly' )->text(),
484 $this->opts
['topOnly'],
485 array( 'class' => 'mw-input' )
490 $dateSelectionAndSubmit = Xml
::tags( 'td', array( 'colspan' => 2 ),
496 $this->msg( 'sp-contributions-submit' )->text(),
497 array( 'class' => 'mw-submit' )
502 Xml
::fieldset( $this->msg( 'sp-contributions-search' )->text() ) .
503 Xml
::openElement( 'table', array( 'class' => 'mw-contributions-table' ) ) .
504 Xml
::openElement( 'tr' ) .
506 Xml
::closeElement( 'tr' ) .
507 Xml
::openElement( 'tr' ) .
508 $namespaceSelection .
509 Xml
::closeElement( 'tr' ) .
510 Xml
::openElement( 'tr' ) .
512 Xml
::closeElement( 'tr' ) .
513 Xml
::openElement( 'tr' ) .
515 Xml
::closeElement( 'tr' ) .
516 Xml
::openElement( 'tr' ) .
517 $dateSelectionAndSubmit .
518 Xml
::closeElement( 'tr' ) .
519 Xml
::closeElement( 'table' );
521 $explain = $this->msg( 'sp-contributions-explain' );
522 if ( $explain->exists() ) {
523 $form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
525 $form .= Xml
::closeElement( 'fieldset' ) .
526 Xml
::closeElement( 'form' );
532 * Pager for Special:Contributions
533 * @ingroup SpecialPage Pager
535 class ContribsPager
extends ReverseChronologicalPager
{
536 public $mDefaultDirection = true;
537 var $messages, $target;
538 var $namespace = '', $mDb;
539 var $preventClickjacking = false;
541 function __construct( IContextSource
$context, array $options ) {
542 parent
::__construct( $context );
544 $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
546 foreach ( $msgs as $msg ) {
547 $this->messages
[$msg] = $this->msg( $msg )->escaped();
550 $this->target
= isset( $options['target'] ) ?
$options['target'] : '';
551 $this->contribs
= isset( $options['contribs'] ) ?
$options['contribs'] : 'users';
552 $this->namespace = isset( $options['namespace'] ) ?
$options['namespace'] : '';
553 $this->tagFilter
= isset( $options['tagfilter'] ) ?
$options['tagfilter'] : false;
554 $this->nsInvert
= isset( $options['nsInvert'] ) ?
$options['nsInvert'] : false;
555 $this->associated
= isset( $options['associated'] ) ?
$options['associated'] : false;
557 $this->deletedOnly
= !empty( $options['deletedOnly'] );
558 $this->topOnly
= !empty( $options['topOnly'] );
560 $year = isset( $options['year'] ) ?
$options['year'] : false;
561 $month = isset( $options['month'] ) ?
$options['month'] : false;
562 $this->getDateCond( $year, $month );
564 $this->mDb
= wfGetDB( DB_SLAVE
, 'contributions' );
567 function getDefaultQuery() {
568 $query = parent
::getDefaultQuery();
569 $query['target'] = $this->target
;
573 function getQueryInfo() {
574 list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
576 $user = $this->getUser();
577 $conds = array_merge( $userCond, $this->getNamespaceCond() );
579 // Paranoia: avoid brute force searches (bug 17342)
580 if ( !$user->isAllowed( 'deletedhistory' ) ) {
581 $conds[] = $this->mDb
->bitAnd( 'rev_deleted', Revision
::DELETED_USER
) . ' = 0';
582 } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
583 $conds[] = $this->mDb
->bitAnd( 'rev_deleted', Revision
::SUPPRESSED_USER
) .
584 ' != ' . Revision
::SUPPRESSED_USER
;
587 # Don't include orphaned revisions
588 $join_cond['page'] = Revision
::pageJoinCond();
589 # Get the current user name for accounts
590 $join_cond['user'] = Revision
::userJoinCond();
594 'fields' => array_merge(
595 Revision
::selectFields(),
596 Revision
::selectUserFields(),
597 array( 'page_namespace', 'page_title', 'page_is_new',
598 'page_latest', 'page_is_redirect', 'page_len' )
601 'options' => array( 'USE INDEX' => array( 'revision' => $index ) ),
602 'join_conds' => $join_cond
605 ChangeTags
::modifyDisplayQuery(
606 $queryInfo['tables'],
607 $queryInfo['fields'],
609 $queryInfo['join_conds'],
610 $queryInfo['options'],
614 wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
618 function getUserCond() {
619 $condition = array();
620 $join_conds = array();
621 $tables = array( 'revision', 'page', 'user' );
622 if ( $this->contribs
== 'newbie' ) {
623 $tables[] = 'user_groups';
624 $max = $this->mDb
->selectField( 'user', 'max(user_id)', false, __METHOD__
);
625 $condition[] = 'rev_user >' . (int)( $max - $max / 100 );
626 $condition[] = 'ug_group IS NULL';
627 $index = 'user_timestamp';
628 # @todo FIXME: Other groups may have 'bot' rights
629 $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" );
631 if ( IP
::isIPAddress( $this->target
) ) {
632 $condition['rev_user_text'] = $this->target
;
633 $index = 'usertext_timestamp';
635 $condition['rev_user'] = User
::idFromName( $this->target
);
636 $index = 'user_timestamp';
639 if ( $this->deletedOnly
) {
640 $condition[] = "rev_deleted != '0'";
642 if ( $this->topOnly
) {
643 $condition[] = "rev_id = page_latest";
645 return array( $tables, $index, $condition, $join_conds );
648 function getNamespaceCond() {
649 if ( $this->namespace !== '' ) {
650 $selectedNS = $this->mDb
->addQuotes( $this->namespace );
651 $eq_op = $this->nsInvert ?
'!=' : '=';
652 $bool_op = $this->nsInvert ?
'AND' : 'OR';
654 if ( !$this->associated
) {
655 return array( "page_namespace $eq_op $selectedNS" );
657 $associatedNS = $this->mDb
->addQuotes (
658 MWNamespace
::getAssociated( $this->namespace )
661 "page_namespace $eq_op $selectedNS " .
663 " page_namespace $eq_op $associatedNS"
672 function getIndexField() {
673 return 'rev_timestamp';
676 function doBatchLookups() {
677 $this->mResult
->rewind();
679 foreach ( $this->mResult
as $row ) {
680 $revIds[] = $row->rev_parent_id
;
682 $this->mParentLens
= $this->getParentLengths( $revIds );
683 $this->mResult
->rewind(); // reset
685 if ( $this->contribs
=== 'newbie' ) { // multiple users
686 # Do a link batch query
687 $this->mResult
->seek( 0 );
688 $batch = new LinkBatch();
689 # Give some pointers to make (last) links
690 foreach ( $this->mResult
as $row ) {
691 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->user_name
) );
692 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->user_name
) );
695 $this->mResult
->seek( 0 );
700 * Do a batched query to get the parent revision lengths
702 private function getParentLengths( array $revIds ) {
705 return $revLens; // empty
707 wfProfileIn( __METHOD__
);
708 $res = $this->getDatabase()->select( 'revision',
709 array( 'rev_id', 'rev_len' ),
710 array( 'rev_id' => $revIds ),
712 foreach ( $res as $row ) {
713 $revLens[$row->rev_id
] = $row->rev_len
;
715 wfProfileOut( __METHOD__
);
722 function getStartBody() {
729 function getEndBody() {
734 * Generates each row in the contributions list.
736 * Contributions which are marked "top" are currently on top of the history.
737 * For these contributions, a [rollback] link is shown for users with roll-
738 * back privileges. The rollback link restores the most recent version that
739 * was not written by the target user.
741 * @todo This would probably look a lot nicer in a table.
743 function formatRow( $row ) {
744 wfProfileIn( __METHOD__
);
746 $rev = new Revision( $row );
749 $page = Title
::newFromRow( $row );
750 $link = Linker
::link(
752 htmlspecialchars( $page->getPrefixedText() ),
754 $page->isRedirect() ?
array( 'redirect' => 'no' ) : array()
756 # Mark current revisions
758 if ( $row->rev_id
== $row->page_latest
) {
759 $topmarktext .= '<span class="mw-uctop">' . $this->messages
['uctop'] . '</span>';
761 if ( !$row->page_is_new
&& $page->quickUserCan( 'rollback' )
762 && $page->quickUserCan( 'edit' ) )
764 $this->preventClickjacking();
765 $topmarktext .= ' ' . Linker
::generateRollback( $rev );
768 $user = $this->getUser();
769 # Is there a visible previous revision?
770 if ( $rev->userCan( Revision
::DELETED_TEXT
, $user ) && $rev->getParentId() !== 0 ) {
771 $difftext = Linker
::linkKnown(
773 $this->messages
['diff'],
777 'oldid' => $row->rev_id
781 $difftext = $this->messages
['diff'];
783 $histlink = Linker
::linkKnown(
785 $this->messages
['hist'],
787 array( 'action' => 'history' )
790 if ( isset( $this->mParentLens
[$row->rev_parent_id
] ) ) {
791 $chardiff = ' . . ' . ChangesList
::showCharacterDifference(
792 $this->mParentLens
[$row->rev_parent_id
], $row->rev_len
) . ' . . ';
797 $lang = $this->getLanguage();
798 $comment = $lang->getDirMark() . Linker
::revComment( $rev, false, true );
799 $date = $lang->userTimeAndDate( $row->rev_timestamp
, $user );
800 if ( $rev->userCan( Revision
::DELETED_TEXT
, $user ) ) {
801 $d = Linker
::linkKnown(
803 htmlspecialchars( $date ),
805 array( 'oldid' => intval( $row->rev_id
) )
808 $d = htmlspecialchars( $date );
810 if ( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
811 $d = '<span class="history-deleted">' . $d . '</span>';
814 # Show user names for /newbies as there may be different users.
815 # Note that we already excluded rows with hidden user names.
816 if ( $this->contribs
== 'newbie' ) {
817 $userlink = ' . . ' . Linker
::userLink( $rev->getUser(), $rev->getUserText() );
818 $userlink .= ' ' . $this->msg( 'parentheses' )->rawParams(
819 Linker
::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';
824 if ( $rev->getParentId() === 0 ) {
825 $nflag = ChangesList
::flag( 'newpage' );
830 if ( $rev->isMinor() ) {
831 $mflag = ChangesList
::flag( 'minor' );
836 $del = Linker
::getRevDeleteLink( $user, $rev, $page );
841 $diffHistLinks = '(' . $difftext . $this->messages
['pipe-separator'] . $histlink . ')';
842 $ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
844 # Denote if username is redacted for this edit
845 if ( $rev->isDeleted( Revision
::DELETED_USER
) ) {
846 $ret .= " <strong>" . $this->msg( 'rev-deleted-user-contribs' )->escaped() . "</strong>";
850 list( $tagSummary, $newClasses ) = ChangeTags
::formatSummaryRow( $row->ts_tags
, 'contributions' );
851 $classes = array_merge( $classes, $newClasses );
852 $ret .= " $tagSummary";
854 // Let extensions add data
855 wfRunHooks( 'ContributionsLineEnding', array( &$this, &$ret, $row ) );
857 $classes = implode( ' ', $classes );
858 $ret = "<li class=\"$classes\">$ret</li>\n";
859 wfProfileOut( __METHOD__
);
864 * Get the Database object in use
866 * @return DatabaseBase
868 public function getDatabase() {
873 * Overwrite Pager function and return a helpful comment
875 function getSqlComment() {
876 if ( $this->namespace ||
$this->deletedOnly
) {
877 return 'contributions page filtered for namespace or RevisionDeleted edits'; // potentially slow, see CR r58153
879 return 'contributions page unfiltered';
883 protected function preventClickjacking() {
884 $this->preventClickjacking
= true;
887 public function getPreventClickjacking() {
888 return $this->preventClickjacking
;