summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialContributions.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialContributions.php')
-rw-r--r--includes/specials/SpecialContributions.php380
1 files changed, 234 insertions, 146 deletions
diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php
index b118059c..1fe98190 100644
--- a/includes/specials/SpecialContributions.php
+++ b/includes/specials/SpecialContributions.php
@@ -28,7 +28,6 @@
*/
class SpecialContributions extends SpecialPage {
-
protected $opts;
public function __construct() {
@@ -65,6 +64,7 @@ class SpecialContributions extends SpecialPage {
if ( !strlen( $target ) ) {
$out->addHTML( $this->getForm() );
+
return;
}
@@ -77,11 +77,13 @@ class SpecialContributions extends SpecialPage {
$nt = Title::makeTitleSafe( NS_USER, $target );
if ( !$nt ) {
$out->addHTML( $this->getForm() );
+
return;
}
$userObj = User::newFromName( $nt->getText(), false );
if ( !$userObj ) {
$out->addHTML( $this->getForm() );
+
return;
}
$id = $userObj->getID();
@@ -89,11 +91,17 @@ class SpecialContributions extends SpecialPage {
if ( $this->opts['contribs'] != 'newbie' ) {
$target = $nt->getText();
$out->addSubtitle( $this->contributionsSub( $userObj ) );
- $out->setHTMLTitle( $this->msg( 'pagetitle', $this->msg( 'contributions-title', $target )->plain() ) );
+ $out->setHTMLTitle( $this->msg(
+ 'pagetitle',
+ $this->msg( 'contributions-title', $target )->plain()
+ ) );
$this->getSkin()->setRelevantUser( $userObj );
} else {
$out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
- $out->setHTMLTitle( $this->msg( 'pagetitle', $this->msg( 'sp-contributions-newbies-title' )->plain() ) );
+ $out->setHTMLTitle( $this->msg(
+ 'pagetitle',
+ $this->msg( 'sp-contributions-newbies-title' )->plain()
+ ) );
}
if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
@@ -103,10 +111,8 @@ class SpecialContributions extends SpecialPage {
}
$this->opts['associated'] = $request->getBool( 'associated' );
-
- $this->opts['nsInvert'] = (bool) $request->getVal( 'nsInvert' );
-
- $this->opts['tagfilter'] = (string) $request->getVal( 'tagfilter' );
+ $this->opts['nsInvert'] = (bool)$request->getVal( 'nsInvert' );
+ $this->opts['tagfilter'] = (string)$request->getVal( 'tagfilter' );
// Allows reverts to have the bot flag in recent changes. It is just here to
// be passed in the form at the top of the page
@@ -152,9 +158,10 @@ class SpecialContributions extends SpecialPage {
$apiParams['month'] = $this->opts['month'];
}
- $url = wfScript( 'api' ) . '?' . wfArrayToCgi( $apiParams );
+ $url = wfAppendQuery( wfScript( 'api' ), $apiParams );
$out->redirect( $url, '301' );
+
return;
}
@@ -162,13 +169,13 @@ class SpecialContributions extends SpecialPage {
$this->addFeedLinks( array( 'action' => 'feedcontributions', 'user' => $target ) );
if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) {
-
$out->addHTML( $this->getForm() );
$pager = new ContribsPager( $this->getContext(), array(
'target' => $target,
'contribs' => $this->opts['contribs'],
'namespace' => $this->opts['namespace'],
+ 'tagfilter' => $this->opts['tagfilter'],
'year' => $this->opts['year'],
'month' => $this->opts['month'],
'deletedOnly' => $this->opts['deletedOnly'],
@@ -176,18 +183,20 @@ class SpecialContributions extends SpecialPage {
'nsInvert' => $this->opts['nsInvert'],
'associated' => $this->opts['associated'],
) );
+
if ( !$pager->getNumRows() ) {
$out->addWikiMsg( 'nocontribs', $target );
} else {
# Show a message about slave lag, if applicable
$lag = wfGetLB()->safeGetLag( $pager->getDatabase() );
- if ( $lag > 0 )
+ if ( $lag > 0 ) {
$out->showLagWarning( $lag );
+ }
$out->addHTML(
'<p>' . $pager->getNavigationBar() . '</p>' .
- $pager->getBody() .
- '<p>' . $pager->getNavigationBar() . '</p>'
+ $pager->getBody() .
+ '<p>' . $pager->getNavigationBar() . '</p>'
);
}
$out->preventClickjacking( $pager->getPreventClickjacking() );
@@ -195,16 +204,16 @@ class SpecialContributions extends SpecialPage {
# Show the appropriate "footer" message - WHOIS tools, etc.
if ( $this->opts['contribs'] == 'newbie' ) {
$message = 'sp-contributions-footer-newbies';
- } elseif( IP::isIPAddress( $target ) ) {
+ } elseif ( IP::isIPAddress( $target ) ) {
$message = 'sp-contributions-footer-anon';
- } elseif( $userObj->isAnon() ) {
+ } elseif ( $userObj->isAnon() ) {
// No message for non-existing users
$message = '';
} else {
$message = 'sp-contributions-footer';
}
- if( $message ) {
+ if ( $message ) {
if ( !$this->msg( $message, $target )->isDisabled() ) {
$out->wrapWikiMsg(
"<div class='mw-contributions-footer'>\n$1\n</div>",
@@ -218,7 +227,8 @@ class SpecialContributions extends SpecialPage {
* Generates the subheading with links
* @param $userObj User object for the target
* @return String: appropriately-escaped HTML to be output literally
- * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php. Could be combined.
+ * @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php.
+ * Could be combined.
*/
protected function contributionsSub( $userObj ) {
if ( $userObj->isAnon() ) {
@@ -258,18 +268,7 @@ class SpecialContributions extends SpecialPage {
}
}
- // Old message 'contribsub' had one parameter, but that doesn't work for
- // languages that want to put the "for" bit right after $user but before
- // $links. If 'contribsub' is around, use it for reverse compatibility,
- // otherwise use 'contribsub2'.
- // @todo Should this be removed at some point?
- $oldMsg = $this->msg( 'contribsub' );
- if ( $oldMsg->exists() ) {
- $linksWithParentheses = $this->msg( 'parentheses' )->rawParams( $links )->escaped();
- return $oldMsg->rawParams( "$user $linksWithParentheses" );
- } else {
- return $this->msg( 'contribsub2' )->rawParams( $user, $links );
- }
+ return $this->msg( 'contribsub2' )->rawParams( $user, $links )->params( $userObj->getName() );
}
/**
@@ -288,7 +287,7 @@ class SpecialContributions extends SpecialPage {
if ( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
if ( $this->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
- if ( $target->isBlocked() ) {
+ if ( $target->isBlocked() && $target->getBlock()->getType() != Block::TYPE_AUTO ) {
$tools[] = Linker::linkKnown( # Change block link
SpecialPage::getTitleFor( 'Block', $username ),
$this->msg( 'change-blocklink' )->escaped()
@@ -304,14 +303,13 @@ class SpecialContributions extends SpecialPage {
);
}
}
+
# Block log link
$tools[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Log', 'block' ),
$this->msg( 'sp-contributions-blocklog' )->escaped(),
array(),
- array(
- 'page' => $userpage->getPrefixedText()
- )
+ array( 'page' => $userpage->getPrefixedText() )
);
}
# Uploads
@@ -345,6 +343,7 @@ class SpecialContributions extends SpecialPage {
}
wfRunHooks( 'ContributionsToolLinks', array( $id, $userpage, &$tools ) );
+
return $tools;
}
@@ -398,10 +397,28 @@ class SpecialContributions extends SpecialPage {
$this->opts['topOnly'] = false;
}
- $form = Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) );
+ $form = Html::openElement(
+ 'form',
+ array(
+ 'method' => 'get',
+ 'action' => $wgScript,
+ 'class' => 'mw-contributions-form'
+ )
+ );
# Add hidden params for tracking except for parameters in $skipParameters
- $skipParameters = array( 'namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated' );
+ $skipParameters = array(
+ 'namespace',
+ 'nsInvert',
+ 'deletedOnly',
+ 'target',
+ 'contribs',
+ 'year',
+ 'month',
+ 'topOnly',
+ 'associated'
+ );
+
foreach ( $this->opts as $name => $value ) {
if ( in_array( $name, $skipParameters ) ) {
continue;
@@ -412,65 +429,82 @@ class SpecialContributions extends SpecialPage {
$tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
if ( $tagFilter ) {
- $filterSelection =
- Html::rawElement( 'td', array( 'class' => 'mw-label' ), array_shift( $tagFilter ) ) .
- Html::rawElement( 'td', array( 'class' => 'mw-input' ), implode( '&#160', $tagFilter ) );
+ $filterSelection = Html::rawElement(
+ 'td',
+ array( 'class' => 'mw-label' ),
+ array_shift( $tagFilter )
+ );
+ $filterSelection .= Html::rawElement(
+ 'td',
+ array( 'class' => 'mw-input' ),
+ implode( '&#160', $tagFilter )
+ );
} else {
$filterSelection = Html::rawElement( 'td', array( 'colspan' => 2 ), '' );
}
- $targetSelection = Html::rawElement( 'td', array( 'colspan' => 2 ),
- Xml::radioLabel(
- $this->msg( 'sp-contributions-newbies' )->text(),
- 'contribs',
- 'newbie',
- 'newbie',
- $this->opts['contribs'] == 'newbie',
- array( 'class' => 'mw-input' )
- ) . '<br />' .
- Xml::radioLabel(
- $this->msg( 'sp-contributions-username' )->text(),
- 'contribs',
- 'user',
- 'user',
- $this->opts['contribs'] == 'user',
- array( 'class' => 'mw-input' )
- ) . ' ' .
- Html::input(
- 'target',
- $this->opts['target'],
- 'text',
- array( 'size' => '40', 'required' => '', 'class' => 'mw-input' ) +
- ( $this->opts['target'] ? array() : array( 'autofocus' )
+ $labelNewbies = Xml::radioLabel(
+ $this->msg( 'sp-contributions-newbies' )->text(),
+ 'contribs',
+ 'newbie',
+ 'newbie',
+ $this->opts['contribs'] == 'newbie',
+ array( 'class' => 'mw-input' )
+ );
+ $labelUsername = Xml::radioLabel(
+ $this->msg( 'sp-contributions-username' )->text(),
+ 'contribs',
+ 'user',
+ 'user',
+ $this->opts['contribs'] == 'user',
+ array( 'class' => 'mw-input' )
+ );
+ $input = Html::input(
+ 'target',
+ $this->opts['target'],
+ 'text',
+ array( 'size' => '40', 'required' => '', 'class' => 'mw-input' ) +
+ ( $this->opts['target'] ? array() : array( 'autofocus' )
)
- ) . ' '
+ );
+ $targetSelection = Html::rawElement(
+ 'td',
+ array( 'colspan' => 2 ),
+ $labelNewbies . '<br />' . $labelUsername . ' ' . $input . ' '
);
- $namespaceSelection =
- Xml::tags( 'td', array( 'class' => 'mw-label' ),
- Xml::label(
- $this->msg( 'namespace' )->text(),
- 'namespace',
- ''
- )
- ) .
- Html::rawElement( 'td', null,
- Html::namespaceSelector( array(
- 'selected' => $this->opts['namespace'],
- 'all' => '',
- ), array(
- 'name' => 'namespace',
- 'id' => 'namespace',
+ $namespaceSelection = Xml::tags(
+ 'td',
+ array( 'class' => 'mw-label' ),
+ Xml::label(
+ $this->msg( 'namespace' )->text(),
+ 'namespace',
+ ''
+ )
+ );
+ $namespaceSelection .= Html::rawElement(
+ 'td',
+ null,
+ Html::namespaceSelector(
+ array( 'selected' => $this->opts['namespace'], 'all' => '' ),
+ array(
+ 'name' => 'namespace',
+ 'id' => 'namespace',
'class' => 'namespaceselector',
- ) ) .
- '&#160;' .
- Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
+ )
+ ) . '&#160;' .
+ Html::rawElement(
+ 'span',
+ array( 'style' => 'white-space: nowrap' ),
Xml::checkLabel(
$this->msg( 'invert' )->text(),
'nsInvert',
'nsInvert',
$this->opts['nsInvert'],
- array( 'title' => $this->msg( 'tooltip-invert' )->text(), 'class' => 'mw-input' )
+ array(
+ 'title' => $this->msg( 'tooltip-invert' )->text(),
+ 'class' => 'mw-input'
+ )
) . '&#160;'
) .
Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
@@ -479,13 +513,18 @@ class SpecialContributions extends SpecialPage {
'associated',
'associated',
$this->opts['associated'],
- array( 'title' => $this->msg( 'tooltip-namespace_association' )->text(), 'class' => 'mw-input' )
+ array(
+ 'title' => $this->msg( 'tooltip-namespace_association' )->text(),
+ 'class' => 'mw-input'
+ )
) . '&#160;'
)
- );
+ );
if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
- $deletedOnlyCheck = Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
+ $deletedOnlyCheck = Html::rawElement(
+ 'span',
+ array( 'style' => 'white-space: nowrap' ),
Xml::checkLabel(
$this->msg( 'history-show-deleted' )->text(),
'deletedOnly',
@@ -498,46 +537,50 @@ class SpecialContributions extends SpecialPage {
$deletedOnlyCheck = '';
}
- $extraOptions = Html::rawElement( 'td', array( 'colspan' => 2 ),
- $deletedOnlyCheck .
- Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
- Xml::checkLabel(
- $this->msg( 'sp-contributions-toponly' )->text(),
- 'topOnly',
- 'mw-show-top-only',
- $this->opts['topOnly'],
- array( 'class' => 'mw-input' )
- )
+ $checkLabelTopOnly = Html::rawElement(
+ 'span',
+ array( 'style' => 'white-space: nowrap' ),
+ Xml::checkLabel(
+ $this->msg( 'sp-contributions-toponly' )->text(),
+ 'topOnly',
+ 'mw-show-top-only',
+ $this->opts['topOnly'],
+ array( 'class' => 'mw-input' )
)
);
+ $extraOptions = Html::rawElement(
+ 'td',
+ array( 'colspan' => 2 ),
+ $deletedOnlyCheck . $checkLabelTopOnly
+ );
$dateSelectionAndSubmit = Xml::tags( 'td', array( 'colspan' => 2 ),
Xml::dateMenu(
- $this->opts['year'],
+ $this->opts['year'] === '' ? MWTimestamp::getInstance()->format( 'Y' ) : $this->opts['year'],
$this->opts['month']
) . ' ' .
- Xml::submitButton(
- $this->msg( 'sp-contributions-submit' )->text(),
- array( 'class' => 'mw-submit' )
- )
+ Xml::submitButton(
+ $this->msg( 'sp-contributions-submit' )->text(),
+ array( 'class' => 'mw-submit' )
+ )
);
- $form .=
- Xml::fieldset( $this->msg( 'sp-contributions-search' )->text() ) .
- Html::rawElement( 'table', array( 'class' => 'mw-contributions-table' ), "\n" .
- Html::rawElement( 'tr', array(), $targetSelection ) . "\n" .
- Html::rawElement( 'tr', array(), $namespaceSelection ) . "\n" .
- Html::rawElement( 'tr', array(), $filterSelection ) . "\n" .
- Html::rawElement( 'tr', array(), $extraOptions ) . "\n" .
- Html::rawElement( 'tr', array(), $dateSelectionAndSubmit ) . "\n"
- );
+ $form .= Xml::fieldset( $this->msg( 'sp-contributions-search' )->text() );
+ $form .= Html::rawElement( 'table', array( 'class' => 'mw-contributions-table' ), "\n" .
+ Html::rawElement( 'tr', array(), $targetSelection ) . "\n" .
+ Html::rawElement( 'tr', array(), $namespaceSelection ) . "\n" .
+ Html::rawElement( 'tr', array(), $filterSelection ) . "\n" .
+ Html::rawElement( 'tr', array(), $extraOptions ) . "\n" .
+ Html::rawElement( 'tr', array(), $dateSelectionAndSubmit ) . "\n"
+ );
$explain = $this->msg( 'sp-contributions-explain' );
if ( !$explain->isBlank() ) {
$form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>";
}
- $form .= Xml::closeElement( 'fieldset' ) .
- Xml::closeElement( 'form' );
+
+ $form .= Xml::closeElement( 'fieldset' ) . Xml::closeElement( 'form' );
+
return $form;
}
@@ -552,9 +595,11 @@ class SpecialContributions extends SpecialPage {
*/
class ContribsPager extends ReverseChronologicalPager {
public $mDefaultDirection = true;
- var $messages, $target;
- var $namespace = '', $mDb;
- var $preventClickjacking = false;
+ public $messages;
+ public $target;
+ public $namespace = '';
+ public $mDb;
+ public $preventClickjacking = false;
/**
* @var array
@@ -564,7 +609,15 @@ class ContribsPager extends ReverseChronologicalPager {
function __construct( IContextSource $context, array $options ) {
parent::__construct( $context );
- $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
+ $msgs = array(
+ 'diff',
+ 'hist',
+ 'newarticle',
+ 'pipe-separator',
+ 'rev-delundel',
+ 'rollbacklink',
+ 'uctop'
+ );
foreach ( $msgs as $msg ) {
$this->messages[$msg] = $this->msg( $msg )->escaped();
@@ -590,6 +643,7 @@ class ContribsPager extends ReverseChronologicalPager {
function getDefaultQuery() {
$query = parent::getDefaultQuery();
$query['target'] = $this->target;
+
return $query;
}
@@ -603,7 +657,11 @@ class ContribsPager extends ReverseChronologicalPager {
* @return ResultWrapper
*/
function reallyDoQuery( $offset, $limit, $descending ) {
- list( $tables, $fields, $conds, $fname, $options, $join_conds ) = $this->buildQueryInfo( $offset, $limit, $descending );
+ list( $tables, $fields, $conds, $fname, $options, $join_conds ) = $this->buildQueryInfo(
+ $offset,
+ $limit,
+ $descending
+ );
$pager = $this;
/*
@@ -624,8 +682,13 @@ class ContribsPager extends ReverseChronologicalPager {
* $limit: see phpdoc above
* $descending: see phpdoc above
*/
- $data = array( $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds ) );
- wfRunHooks( 'ContribsPager::reallyDoQuery', array( &$data, $pager, $offset, $limit, $descending ) );
+ $data = array( $this->mDb->select(
+ $tables, $fields, $conds, $fname, $options, $join_conds
+ ) );
+ wfRunHooks(
+ 'ContribsPager::reallyDoQuery',
+ array( &$data, $pager, $offset, $limit, $descending )
+ );
$result = array();
@@ -673,15 +736,15 @@ class ContribsPager extends ReverseChronologicalPager {
$join_cond['user'] = Revision::userJoinCond();
$queryInfo = array(
- 'tables' => $tables,
- 'fields' => array_merge(
+ 'tables' => $tables,
+ 'fields' => array_merge(
Revision::selectFields(),
Revision::selectUserFields(),
array( 'page_namespace', 'page_title', 'page_is_new',
'page_latest', 'page_is_redirect', 'page_len' )
),
- 'conds' => $conds,
- 'options' => array( 'USE INDEX' => array( 'revision' => $index ) ),
+ 'conds' => $conds,
+ 'options' => array( 'USE INDEX' => array( 'revision' => $index ) ),
'join_conds' => $join_cond
);
@@ -695,6 +758,7 @@ class ContribsPager extends ReverseChronologicalPager {
);
wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
+
return $queryInfo;
}
@@ -709,7 +773,7 @@ class ContribsPager extends ReverseChronologicalPager {
# ignore local groups with the bot right
# @todo FIXME: Global groups may have 'bot' rights
$groupsWithBotPermission = User::getGroupsWithPermission( 'bot' );
- if( count( $groupsWithBotPermission ) ) {
+ if ( count( $groupsWithBotPermission ) ) {
$tables[] = 'user_groups';
$condition[] = 'ug_group IS NULL';
$join_conds['user_groups'] = array(
@@ -729,12 +793,15 @@ class ContribsPager extends ReverseChronologicalPager {
$index = 'usertext_timestamp';
}
}
+
if ( $this->deletedOnly ) {
$condition[] = 'rev_deleted != 0';
}
+
if ( $this->topOnly ) {
$condition[] = 'rev_id = page_latest';
}
+
return array( $tables, $index, $condition, $join_conds );
}
@@ -746,20 +813,20 @@ class ContribsPager extends ReverseChronologicalPager {
if ( !$this->associated ) {
return array( "page_namespace $eq_op $selectedNS" );
- } else {
- $associatedNS = $this->mDb->addQuotes (
- MWNamespace::getAssociated( $this->namespace )
- );
- return array(
- "page_namespace $eq_op $selectedNS " .
- $bool_op .
- " page_namespace $eq_op $associatedNS"
- );
}
- } else {
- return array();
+ $associatedNS = $this->mDb->addQuotes(
+ MWNamespace::getAssociated( $this->namespace )
+ );
+
+ return array(
+ "page_namespace $eq_op $selectedNS " .
+ $bool_op .
+ " page_namespace $eq_op $associatedNS"
+ );
}
+
+ return array();
}
function getIndexField() {
@@ -773,7 +840,7 @@ class ContribsPager extends ReverseChronologicalPager {
$batch = new LinkBatch();
# Give some pointers to make (last) links
foreach ( $this->mResult as $row ) {
- if( isset( $row->rev_parent_id ) && $row->rev_parent_id ) {
+ if ( isset( $row->rev_parent_id ) && $row->rev_parent_id ) {
$revIds[] = $row->rev_parent_id;
}
if ( isset( $row->rev_id ) ) {
@@ -830,7 +897,7 @@ class ContribsPager extends ReverseChronologicalPager {
*/
wfSuppressWarnings();
$rev = new Revision( $row );
- $validRevision = (bool) $rev->getId();
+ $validRevision = (bool)$rev->getId();
wfRestoreWarnings();
if ( $validRevision ) {
@@ -850,8 +917,8 @@ class ContribsPager extends ReverseChronologicalPager {
$topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
# Add rollback link
if ( !$row->page_is_new && $page->quickUserCan( 'rollback', $user )
- && $page->quickUserCan( 'edit', $user ) )
- {
+ && $page->quickUserCan( 'edit', $user )
+ ) {
$this->preventClickjacking();
$topmarktext .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
}
@@ -881,11 +948,22 @@ class ContribsPager extends ReverseChronologicalPager {
// For some reason rev_parent_id isn't populated for this row.
// Its rumoured this is true on wikipedia for some revisions (bug 34922).
// Next best thing is to have the total number of bytes.
- $chardiff = ' <span class="mw-changeslist-separator">. .</span> ' . Linker::formatRevisionSize( $row->rev_len ) . ' <span class="mw-changeslist-separator">. .</span> ';
+ $chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
+ $chardiff .= Linker::formatRevisionSize( $row->rev_len );
+ $chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
} else {
- $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? $this->mParentLens[$row->rev_parent_id] : 0;
- $chardiff = ' <span class="mw-changeslist-separator">. .</span> ' . ChangesList::showCharacterDifference(
- $parentLen, $row->rev_len, $this->getContext() ) . ' <span class="mw-changeslist-separator">. .</span> ';
+ $parentLen = 0;
+ if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) {
+ $parentLen = $this->mParentLens[$row->rev_parent_id];
+ }
+
+ $chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
+ $chardiff .= ChangesList::showCharacterDifference(
+ $parentLen,
+ $row->rev_len,
+ $this->getContext()
+ );
+ $chardiff .= ' <span class="mw-changeslist-separator">. .</span> ';
}
$lang = $this->getLanguage();
@@ -908,7 +986,7 @@ class ContribsPager extends ReverseChronologicalPager {
# Show user names for /newbies as there may be different users.
# Note that we already excluded rows with hidden user names.
if ( $this->contribs == 'newbie' ) {
- $userlink = ' . . ' . Linker::userLink( $rev->getUser(), $rev->getUserText() );
+ $userlink = ' . . ' . $lang->getDirMark() . Linker::userLink( $rev->getUser(), $rev->getUserText() );
$userlink .= ' ' . $this->msg( 'parentheses' )->rawParams(
Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';
} else {
@@ -932,16 +1010,24 @@ class ContribsPager extends ReverseChronologicalPager {
$del .= ' ';
}
- $diffHistLinks = $this->msg( 'parentheses' )->rawParams( $difftext . $this->messages['pipe-separator'] . $histlink )->escaped();
- $ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
+ $diffHistLinks = $this->msg( 'parentheses' )
+ ->rawParams( $difftext . $this->messages['pipe-separator'] . $histlink )
+ ->escaped();
+ $ret = "{$del}{$d} {$diffHistLinks}{$chardiff}{$nflag}{$mflag} ";
+ $ret .= "{$link}{$userlink} {$comment} {$topmarktext}";
# Denote if username is redacted for this edit
if ( $rev->isDeleted( Revision::DELETED_USER ) ) {
- $ret .= " <strong>" . $this->msg( 'rev-deleted-user-contribs' )->escaped() . "</strong>";
+ $ret .= " <strong>" .
+ $this->msg( 'rev-deleted-user-contribs' )->escaped() .
+ "</strong>";
}
# Tags, if any.
- list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'contributions' );
+ list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
+ $row->ts_tags,
+ 'contributions'
+ );
$classes = array_merge( $classes, $newClasses );
$ret .= " $tagSummary";
}
@@ -957,6 +1043,7 @@ class ContribsPager extends ReverseChronologicalPager {
}
wfProfileOut( __METHOD__ );
+
return $ret;
}
@@ -966,7 +1053,8 @@ class ContribsPager extends ReverseChronologicalPager {
*/
function getSqlComment() {
if ( $this->namespace || $this->deletedOnly ) {
- return 'contributions page filtered for namespace or RevisionDeleted edits'; // potentially slow, see CR r58153
+ // potentially slow, see CR r58153
+ return 'contributions page filtered for namespace or RevisionDeleted edits';
} else {
return 'contributions page unfiltered';
}