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 !== null ) {
50 $target = $request->getVal( 'target' );
54 if ( $request->getVal( 'contribs' ) == 'newbie' ) {
56 $this->opts
['contribs'] = 'newbie';
58 $this->opts
['contribs'] = 'user';
61 $this->opts
['deletedOnly'] = $request->getBool( 'deletedOnly' );
63 if ( !strlen( $target ) ) {
64 $out->addHTML( $this->getForm() );
68 $user = $this->getUser();
70 $this->opts
['limit'] = $request->getInt( 'limit', $user->getOption( 'rclimit' ) );
71 $this->opts
['target'] = $target;
72 $this->opts
['topOnly'] = $request->getBool( 'topOnly' );
74 $userObj = User
::newFromName( $target, false );
76 $out->addHTML( $this->getForm() );
79 $nt = $userObj->getUserPage();
80 $id = $userObj->getID();
82 if ( $this->opts
['contribs'] != 'newbie' ) {
83 $target = $nt->getText();
84 $out->addSubtitle( $this->contributionsSub( $userObj ) );
85 $out->setHTMLTitle( $this->msg( 'pagetitle', $this->msg( 'contributions-title', $target )->plain() ) );
86 $this->getSkin()->setRelevantUser( $userObj );
88 $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
89 $out->setHTMLTitle( $this->msg( 'pagetitle', $this->msg( 'sp-contributions-newbies-title' )->plain() ) );
92 if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
93 $this->opts
['namespace'] = intval( $ns );
95 $this->opts
['namespace'] = '';
98 $this->opts
['associated'] = $request->getBool( 'associated' );
100 $this->opts
['nsInvert'] = (bool) $request->getVal( 'nsInvert' );
102 $this->opts
['tagfilter'] = (string) $request->getVal( 'tagfilter' );
104 // Allows reverts to have the bot flag in recent changes. It is just here to
105 // be passed in the form at the top of the page
106 if ( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
107 $this->opts
['bot'] = '1';
110 $skip = $request->getText( 'offset' ) ||
$request->getText( 'dir' ) == 'prev';
111 # Offset overrides year/month selection
113 $this->opts
['year'] = '';
114 $this->opts
['month'] = '';
116 $this->opts
['year'] = $request->getIntOrNull( 'year' );
117 $this->opts
['month'] = $request->getIntOrNull( 'month' );
120 $feedType = $request->getVal( 'feed' );
122 // Maintain some level of backwards compatability
123 // If people request feeds using the old parameters, redirect to API
125 'action' => 'feedcontributions',
126 'feedformat' => $feedType,
129 if ( $this->opts
['topOnly'] ) {
130 $apiParams['toponly'] = true;
132 if ( $this->opts
['deletedOnly'] ) {
133 $apiParams['deletedonly'] = true;
135 if ( $this->opts
['tagfilter'] !== '' ) {
136 $apiParams['tagfilter'] = $this->opts
['tagfilter'];
138 if ( $this->opts
['namespace'] !== '' ) {
139 $apiParams['namespace'] = $this->opts
['namespace'];
141 if ( $this->opts
['year'] !== null ) {
142 $apiParams['year'] = $this->opts
['year'];
144 if ( $this->opts
['month'] !== null ) {
145 $apiParams['month'] = $this->opts
['month'];
148 $url = wfScript( 'api' ) . '?' . wfArrayToCGI( $apiParams );
150 $out->redirect( $url, '301' );
154 // Add RSS/atom links
155 $this->addFeedLinks( array( 'action' => 'feedcontributions', 'user' => $target ) );
157 if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) {
159 $out->addHTML( $this->getForm() );
161 $pager = new ContribsPager( $this->getContext(), array(
163 'contribs' => $this->opts
['contribs'],
164 'namespace' => $this->opts
['namespace'],
165 'year' => $this->opts
['year'],
166 'month' => $this->opts
['month'],
167 'deletedOnly' => $this->opts
['deletedOnly'],
168 'topOnly' => $this->opts
['topOnly'],
169 'nsInvert' => $this->opts
['nsInvert'],
170 'associated' => $this->opts
['associated'],
172 if ( !$pager->getNumRows() ) {
173 $out->addWikiMsg( 'nocontribs', $target );
175 # Show a message about slave lag, if applicable
176 $lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
178 $out->showLagWarning( $lag );
181 '<p>' . $pager->getNavigationBar() . '</p>' .
183 '<p>' . $pager->getNavigationBar() . '</p>'
186 $out->preventClickjacking( $pager->getPreventClickjacking() );
188 # Show the appropriate "footer" message - WHOIS tools, etc.
189 if ( $this->opts
['contribs'] != 'newbie' ) {
190 $message = 'sp-contributions-footer';
191 if ( IP
::isIPAddress( $target ) ) {
192 $message = 'sp-contributions-footer-anon';
194 if ( $userObj->isAnon() ) {
195 // No message for non-existing users
200 if ( !$this->msg( $message, $target )->isDisabled() ) {
202 "<div class='mw-contributions-footer'>\n$1\n</div>",
203 array( $message, $target ) );
210 * Generates the subheading with links
211 * @param $userObj User object for the target
212 * @return String: appropriately-escaped HTML to be output literally
213 * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
215 protected function contributionsSub( $userObj ) {
216 if ( $userObj->isAnon() ) {
217 $user = htmlspecialchars( $userObj->getName() );
219 $user = Linker
::link( $userObj->getUserPage(), htmlspecialchars( $userObj->getName() ) );
221 $nt = $userObj->getUserPage();
222 $talk = $userObj->getTalkPage();
224 $tools = $this->getUserLinks( $nt, $talk, $userObj );
225 $links = $this->getLanguage()->pipeList( $tools );
227 // Show a note if the user is blocked and display the last block log entry.
228 if ( $userObj->isBlocked() ) {
229 $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
230 LogEventsList
::showLogExtract(
237 'showIfEmpty' => false,
240 'sp-contributions-blocked-notice-anon' :
241 'sp-contributions-blocked-notice',
242 $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
244 'offset' => '' # don't use WebRequest parameter offset
250 // Old message 'contribsub' had one parameter, but that doesn't work for
251 // languages that want to put the "for" bit right after $user but before
252 // $links. If 'contribsub' is around, use it for reverse compatibility,
253 // otherwise use 'contribsub2'.
254 $oldMsg = $this->msg( 'contribsub' );
255 if ( $oldMsg->exists() ) {
256 return $oldMsg->rawParams( "$user ($links)" );
258 return $this->msg( 'contribsub2' )->rawParams( $user, $links );
263 * Links to different places.
264 * @param $userpage Title: Target user page
265 * @param $talkpage Title: Talk page
266 * @param $target User: Target user object
269 public function getUserLinks( Title
$userpage, Title
$talkpage, User
$target ) {
271 $id = $target->getId();
272 $username = $target->getName();
274 $tools[] = Linker
::link( $talkpage, $this->msg( 'sp-contributions-talk' )->escaped() );
276 if ( ( $id !== null ) ||
( $id === null && IP
::isIPAddress( $username ) ) ) {
277 if ( $this->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
278 if ( $target->isBlocked() ) {
279 $tools[] = Linker
::linkKnown( # Change block link
280 SpecialPage
::getTitleFor( 'Block', $username ),
281 $this->msg( 'change-blocklink' )->escaped()
283 $tools[] = Linker
::linkKnown( # Unblock link
284 SpecialPage
::getTitleFor( 'Unblock', $username ),
285 $this->msg( 'unblocklink' )->escaped()
287 } else { # User is not blocked
288 $tools[] = Linker
::linkKnown( # Block link
289 SpecialPage
::getTitleFor( 'Block', $username ),
290 $this->msg( 'blocklink' )->escaped()
295 $tools[] = Linker
::linkKnown(
296 SpecialPage
::getTitleFor( 'Log', 'block' ),
297 $this->msg( 'sp-contributions-blocklog' )->escaped(),
300 'page' => $userpage->getPrefixedText()
305 $tools[] = Linker
::linkKnown(
306 SpecialPage
::getTitleFor( 'Listfiles', $username ),
307 $this->msg( 'sp-contributions-uploads' )->escaped()
311 $tools[] = Linker
::linkKnown(
312 SpecialPage
::getTitleFor( 'Log', $username ),
313 $this->msg( 'sp-contributions-logs' )->escaped()
316 # Add link to deleted user contributions for priviledged users
317 if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
318 $tools[] = Linker
::linkKnown(
319 SpecialPage
::getTitleFor( 'DeletedContributions', $username ),
320 $this->msg( 'sp-contributions-deleted' )->escaped()
324 # Add a link to change user rights for privileged users
325 $userrightsPage = new UserrightsPage();
326 $userrightsPage->setContext( $this->getContext() );
327 if ( $id !== null && $userrightsPage->userCanChangeRights( $target ) ) {
328 $tools[] = Linker
::linkKnown(
329 SpecialPage
::getTitleFor( 'Userrights', $username ),
330 $this->msg( 'sp-contributions-userrights' )->escaped()
334 wfRunHooks( 'ContributionsToolLinks', array( $id, $userpage, &$tools ) );
339 * Generates the namespace selector form with hidden attributes.
340 * @return String: HTML fragment
342 protected function getForm() {
345 $this->opts
['title'] = $this->getTitle()->getPrefixedText();
346 if ( !isset( $this->opts
['target'] ) ) {
347 $this->opts
['target'] = '';
349 $this->opts
['target'] = str_replace( '_' , ' ' , $this->opts
['target'] );
352 if ( !isset( $this->opts
['namespace'] ) ) {
353 $this->opts
['namespace'] = '';
356 if ( !isset( $this->opts
['nsInvert'] ) ) {
357 $this->opts
['nsInvert'] = '';
360 if ( !isset( $this->opts
['associated'] ) ) {
361 $this->opts
['associated'] = false;
364 if ( !isset( $this->opts
['contribs'] ) ) {
365 $this->opts
['contribs'] = 'user';
368 if ( !isset( $this->opts
['year'] ) ) {
369 $this->opts
['year'] = '';
372 if ( !isset( $this->opts
['month'] ) ) {
373 $this->opts
['month'] = '';
376 if ( $this->opts
['contribs'] == 'newbie' ) {
377 $this->opts
['target'] = '';
380 if ( !isset( $this->opts
['tagfilter'] ) ) {
381 $this->opts
['tagfilter'] = '';
384 if ( !isset( $this->opts
['topOnly'] ) ) {
385 $this->opts
['topOnly'] = false;
388 $form = Xml
::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) );
390 # Add hidden params for tracking except for parameters in $skipParameters
391 $skipParameters = array( 'namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated' );
392 foreach ( $this->opts
as $name => $value ) {
393 if ( in_array( $name, $skipParameters ) ) {
396 $form .= "\t" . Html
::hidden( $name, $value ) . "\n";
399 $tagFilter = ChangeTags
::buildTagFilterSelector( $this->opts
['tagfilter'] );
403 Xml
::tags( 'td', array( 'class' => 'mw-label' ), array_shift( $tagFilter ) ) .
404 Xml
::tags( 'td', array( 'class' => 'mw-input' ), implode( ' ', $tagFilter ) );
406 $filterSelection = Xml
::tags( 'td', array( 'colspan' => 2 ), '' );
409 $targetSelection = Xml
::tags( 'td', array( 'colspan' => 2 ),
411 $this->msg( 'sp-contributions-newbies' )->text(),
415 $this->opts
['contribs'] == 'newbie',
416 array( 'class' => 'mw-input' )
419 $this->msg( 'sp-contributions-username' )->text(),
423 $this->opts
['contribs'] == 'user',
424 array( 'class' => 'mw-input' )
428 $this->opts
['target'],
430 array( 'size' => '20', 'required' => '', 'class' => 'mw-input' ) +
431 ( $this->opts
['target'] ?
array() : array( 'autofocus' )
436 $namespaceSelection =
437 Xml
::tags( 'td', array( 'class' => 'mw-label' ),
439 $this->msg( 'namespace' )->text(),
444 Xml
::tags( 'td', null,
445 Xml
::namespaceSelector( $this->opts
['namespace'], '' ) . ' ' .
446 Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
448 $this->msg( 'invert' )->text(),
451 $this->opts
['nsInvert'],
452 array( 'title' => $this->msg( 'tooltip-invert' )->text(), 'class' => 'mw-input' )
455 Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
457 $this->msg( 'namespace_association' )->text(),
460 $this->opts
['associated'],
461 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text(), 'class' => 'mw-input' )
466 $extraOptions = Xml
::tags( 'td', array( 'colspan' => 2 ),
467 Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
469 $this->msg( 'history-show-deleted' )->text(),
471 'mw-show-deleted-only',
472 $this->opts
['deletedOnly'],
473 array( 'class' => 'mw-input' )
476 Html
::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
478 $this->msg( 'sp-contributions-toponly' )->text(),
481 $this->opts
['topOnly'],
482 array( 'class' => 'mw-input' )
487 $dateSelectionAndSubmit = Xml
::tags( 'td', array( 'colspan' => 2 ),
493 $this->msg( 'sp-contributions-submit' )->text(),
494 array( 'class' => 'mw-submit' )
499 Xml
::fieldset( $this->msg( 'sp-contributions-search' )->text() ) .
500 Xml
::openElement( 'table', array( 'class' => 'mw-contributions-table' ) ) .
501 Xml
::openElement( 'tr' ) .
503 Xml
::closeElement( 'tr' ) .
504 Xml
::openElement( 'tr' ) .
505 $namespaceSelection .
506 Xml
::closeElement( 'tr' ) .
507 Xml
::openElement( 'tr' ) .
509 Xml
::closeElement( 'tr' ) .
510 Xml
::openElement( 'tr' ) .
512 Xml
::closeElement( 'tr' ) .
513 Xml
::openElement( 'tr' ) .
514 $dateSelectionAndSubmit .
515 Xml
::closeElement( 'tr' ) .
516 Xml
::closeElement( 'table' );
518 $explain = $this->msg( 'sp-contributions-explain' );
519 if ( $explain->exists() ) {
520 $form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
522 $form .= Xml
::closeElement( 'fieldset' ) .
523 Xml
::closeElement( 'form' );
529 * Pager for Special:Contributions
530 * @ingroup SpecialPage Pager
532 class ContribsPager
extends ReverseChronologicalPager
{
533 public $mDefaultDirection = true;
534 var $messages, $target;
535 var $namespace = '', $mDb;
536 var $preventClickjacking = false;
538 function __construct( IContextSource
$context, array $options ) {
539 parent
::__construct( $context );
541 $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
543 foreach ( $msgs as $msg ) {
544 $this->messages
[$msg] = $this->msg( $msg )->escaped();
547 $this->target
= isset( $options['target'] ) ?
$options['target'] : '';
548 $this->contribs
= isset( $options['contribs'] ) ?
$options['contribs'] : 'users';
549 $this->namespace = isset( $options['namespace'] ) ?
$options['namespace'] : '';
550 $this->tagFilter
= isset( $options['tagfilter'] ) ?
$options['tagfilter'] : false;
551 $this->nsInvert
= isset( $options['nsInvert'] ) ?
$options['nsInvert'] : false;
552 $this->associated
= isset( $options['associated'] ) ?
$options['associated'] : false;
554 $this->deletedOnly
= !empty( $options['deletedOnly'] );
555 $this->topOnly
= !empty( $options['topOnly'] );
557 $year = isset( $options['year'] ) ?
$options['year'] : false;
558 $month = isset( $options['month'] ) ?
$options['month'] : false;
559 $this->getDateCond( $year, $month );
561 $this->mDb
= wfGetDB( DB_SLAVE
, 'contributions' );
564 function getDefaultQuery() {
565 $query = parent
::getDefaultQuery();
566 $query['target'] = $this->target
;
570 function getQueryInfo() {
571 list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
573 $user = $this->getUser();
574 $conds = array_merge( $userCond, $this->getNamespaceCond() );
576 // Paranoia: avoid brute force searches (bug 17342)
577 if ( !$user->isAllowed( 'deletedhistory' ) ) {
578 $conds[] = $this->mDb
->bitAnd( 'rev_deleted', Revision
::DELETED_USER
) . ' = 0';
579 } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
580 $conds[] = $this->mDb
->bitAnd( 'rev_deleted', Revision
::SUPPRESSED_USER
) .
581 ' != ' . Revision
::SUPPRESSED_USER
;
584 # Don't include orphaned revisions
585 $join_cond['page'] = Revision
::pageJoinCond();
586 # Get the current user name for accounts
587 $join_cond['user'] = Revision
::userJoinCond();
591 'fields' => array_merge(
592 Revision
::selectFields(),
593 Revision
::selectUserFields(),
594 array( 'page_namespace', 'page_title', 'page_is_new',
595 'page_latest', 'page_is_redirect', 'page_len' )
598 'options' => array( 'USE INDEX' => array( 'revision' => $index ) ),
599 'join_conds' => $join_cond
602 ChangeTags
::modifyDisplayQuery(
603 $queryInfo['tables'],
604 $queryInfo['fields'],
606 $queryInfo['join_conds'],
607 $queryInfo['options'],
611 wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
615 function getUserCond() {
616 $condition = array();
617 $join_conds = array();
618 $tables = array( 'revision', 'page', 'user' );
619 if ( $this->contribs
== 'newbie' ) {
620 $tables[] = 'user_groups';
621 $max = $this->mDb
->selectField( 'user', 'max(user_id)', false, __METHOD__
);
622 $condition[] = 'rev_user >' . (int)( $max - $max / 100 );
623 $condition[] = 'ug_group IS NULL';
624 $index = 'user_timestamp';
625 # @todo FIXME: Other groups may have 'bot' rights
626 $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" );
628 if ( IP
::isIPAddress( $this->target
) ) {
629 $condition['rev_user_text'] = $this->target
;
630 $index = 'usertext_timestamp';
632 $condition['rev_user'] = User
::idFromName( $this->target
);
633 $index = 'user_timestamp';
636 if ( $this->deletedOnly
) {
637 $condition[] = "rev_deleted != '0'";
639 if ( $this->topOnly
) {
640 $condition[] = "rev_id = page_latest";
642 return array( $tables, $index, $condition, $join_conds );
645 function getNamespaceCond() {
646 if ( $this->namespace !== '' ) {
647 $selectedNS = $this->mDb
->addQuotes( $this->namespace );
648 $eq_op = $this->nsInvert ?
'!=' : '=';
649 $bool_op = $this->nsInvert ?
'AND' : 'OR';
651 if ( !$this->associated
) {
652 return array( "page_namespace $eq_op $selectedNS" );
654 $associatedNS = $this->mDb
->addQuotes (
655 MWNamespace
::getAssociated( $this->namespace )
658 "page_namespace $eq_op $selectedNS " .
660 " page_namespace $eq_op $associatedNS"
669 function getIndexField() {
670 return 'rev_timestamp';
673 function doBatchLookups() {
674 $this->mResult
->rewind();
676 foreach ( $this->mResult
as $row ) {
677 if( $row->rev_parent_id
) {
678 $revIds[] = $row->rev_parent_id
;
681 $this->mParentLens
= $this->getParentLengths( $revIds );
682 $this->mResult
->rewind(); // reset
684 # Do a link batch query
685 $this->mResult
->seek( 0 );
686 $batch = new LinkBatch();
687 # Give some pointers to make (last) links
688 foreach ( $this->mResult
as $row ) {
689 if ( $this->contribs
=== 'newbie' ) { // multiple users
690 $batch->add( NS_USER
, $row->user_name
);
691 $batch->add( NS_USER_TALK
, $row->user_name
);
693 $batch->add( $row->page_namespace
, $row->page_title
);
696 $this->mResult
->seek( 0 );
700 * Do a batched query to get the parent revision lengths
703 private function getParentLengths( array $revIds ) {
706 return $revLens; // empty
708 wfProfileIn( __METHOD__
);
709 $res = $this->getDatabase()->select( 'revision',
710 array( 'rev_id', 'rev_len' ),
711 array( 'rev_id' => $revIds ),
713 foreach ( $res as $row ) {
714 $revLens[$row->rev_id
] = $row->rev_len
;
716 wfProfileOut( __METHOD__
);
723 function getStartBody() {
730 function getEndBody() {
735 * Generates each row in the contributions list.
737 * Contributions which are marked "top" are currently on top of the history.
738 * For these contributions, a [rollback] link is shown for users with roll-
739 * back privileges. The rollback link restores the most recent version that
740 * was not written by the target user.
742 * @todo This would probably look a lot nicer in a table.
745 function formatRow( $row ) {
746 wfProfileIn( __METHOD__
);
748 $rev = new Revision( $row );
751 $page = Title
::newFromRow( $row );
752 $link = Linker
::link(
754 htmlspecialchars( $page->getPrefixedText() ),
756 $page->isRedirect() ?
array( 'redirect' => 'no' ) : array()
758 # Mark current revisions
760 if ( $row->rev_id
== $row->page_latest
) {
761 $topmarktext .= '<span class="mw-uctop">' . $this->messages
['uctop'] . '</span>';
763 if ( !$row->page_is_new
&& $page->quickUserCan( 'rollback' )
764 && $page->quickUserCan( 'edit' ) )
766 $this->preventClickjacking();
767 $topmarktext .= ' ' . Linker
::generateRollback( $rev );
770 $user = $this->getUser();
771 # Is there a visible previous revision?
772 if ( $rev->userCan( Revision
::DELETED_TEXT
, $user ) && $rev->getParentId() !== 0 ) {
773 $difftext = Linker
::linkKnown(
775 $this->messages
['diff'],
779 'oldid' => $row->rev_id
783 $difftext = $this->messages
['diff'];
785 $histlink = Linker
::linkKnown(
787 $this->messages
['hist'],
789 array( 'action' => 'history' )
792 $parentLen = isset( $this->mParentLens
[$row->rev_parent_id
] ) ?
$this->mParentLens
[$row->rev_parent_id
] : 0;
793 $chardiff = ' . . ' . ChangesList
::showCharacterDifference(
794 $parentLen, $row->rev_len
) . ' . . ';
796 $lang = $this->getLanguage();
797 $comment = $lang->getDirMark() . Linker
::revComment( $rev, false, true );
798 $date = $lang->userTimeAndDate( $row->rev_timestamp
, $user );
799 if ( $rev->userCan( Revision
::DELETED_TEXT
, $user ) ) {
800 $d = Linker
::linkKnown(
802 htmlspecialchars( $date ),
804 array( 'oldid' => intval( $row->rev_id
) )
807 $d = htmlspecialchars( $date );
809 if ( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
810 $d = '<span class="history-deleted">' . $d . '</span>';
813 # Show user names for /newbies as there may be different users.
814 # Note that we already excluded rows with hidden user names.
815 if ( $this->contribs
== 'newbie' ) {
816 $userlink = ' . . ' . Linker
::userLink( $rev->getUser(), $rev->getUserText() );
817 $userlink .= ' ' . $this->msg( 'parentheses' )->rawParams(
818 Linker
::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';
823 if ( $rev->getParentId() === 0 ) {
824 $nflag = ChangesList
::flag( 'newpage' );
829 if ( $rev->isMinor() ) {
830 $mflag = ChangesList
::flag( 'minor' );
835 $del = Linker
::getRevDeleteLink( $user, $rev, $page );
840 $diffHistLinks = '(' . $difftext . $this->messages
['pipe-separator'] . $histlink . ')';
841 $ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
843 # Denote if username is redacted for this edit
844 if ( $rev->isDeleted( Revision
::DELETED_USER
) ) {
845 $ret .= " <strong>" . $this->msg( 'rev-deleted-user-contribs' )->escaped() . "</strong>";
849 list( $tagSummary, $newClasses ) = ChangeTags
::formatSummaryRow( $row->ts_tags
, 'contributions' );
850 $classes = array_merge( $classes, $newClasses );
851 $ret .= " $tagSummary";
853 // Let extensions add data
854 wfRunHooks( 'ContributionsLineEnding', array( &$this, &$ret, $row ) );
856 $classes = implode( ' ', $classes );
857 $ret = "<li class=\"$classes\">$ret</li>\n";
858 wfProfileOut( __METHOD__
);
863 * Get the Database object in use
865 * @return DatabaseBase
867 public function getDatabase() {
872 * 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
;