From 10e93f24a3b71a91289fd44571bf33e9ca2c0da8 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 25 Oct 2011 18:19:26 +0000 Subject: [PATCH] * Removed $wgRCShowChangedSize check in sp:Contributions for size diffs since this isn't RC * Replaced revision size information on history pages with size diff to be consistent with other places --- includes/actions/HistoryAction.php | 27 +++++++++++++++------- includes/specials/SpecialContributions.php | 18 ++++++--------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 23e922edc5..3775bf1a01 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -498,7 +498,7 @@ class HistoryPager extends ReverseChronologicalPager { * @todo document some more, and maybe clean up the code (some params redundant?) * * @param $row Object: the database row corresponding to the previous line. - * @param $next Mixed: the database row corresponding to the next line. + * @param $next Mixed: the database row corresponding to the next line. (chronologically previous) * @param $notificationtimestamp * @param $latest Boolean: whether this row corresponds to the page's latest revision. * @param $firstInList Boolean: whether this row corresponds to the first displayed on this history page. @@ -510,6 +510,13 @@ class HistoryPager extends ReverseChronologicalPager { $rev = new Revision( $row ); $rev->setTitle( $this->getTitle() ); + if ( is_object( $next ) ) { + $prevRev = new Revision( $next ); + $prevRev->setTitle( $this->getTitle() ); + } else { + $prevRev = null; + } + $curlink = $this->curLink( $rev, $latest ); $lastlink = $this->lastLink( $rev, $next ); $diffButtons = $this->diffButtons( $rev, $firstInList ); @@ -566,8 +573,12 @@ class HistoryPager extends ReverseChronologicalPager { $s .= ' ' . ChangesList::flag( 'minor' ); } - if ( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) { - $s .= ' ' . Linker::formatRevisionSize( $size ); + if ( $prevRev + && !$prevRev->isDeleted( Revision::DELETED_TEXT ) + && !$rev->isDeleted( Revision::DELETED_TEXT ) ) + { + $sDiff = ChangesList::showCharacterDifference( $prevRev->getSize(), $rev->getSize() ); + $s .= ' . . ' . $sDiff . ' . . '; } $s .= Linker::revComment( $rev, false, true ); @@ -579,7 +590,7 @@ class HistoryPager extends ReverseChronologicalPager { $tools = array(); # Rollback and undo links - if ( !is_null( $next ) && is_object( $next ) && + if ( $prevRev && !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) ) ) { if ( $latest && !count( $this->getTitle()->getUserPermissionsErrors( 'rollback', $this->getUser() ) ) ) { @@ -589,7 +600,7 @@ class HistoryPager extends ReverseChronologicalPager { } if ( !$rev->isDeleted( Revision::DELETED_TEXT ) - && !$next->rev_deleted & Revision::DELETED_TEXT ) + && !$prevRev->isDeleted( Revision::DELETED_TEXT ) ) { # Create undo tooltip for the first (=latest) line only $undoTooltip = $latest @@ -600,9 +611,9 @@ class HistoryPager extends ReverseChronologicalPager { $this->msg( 'editundo' )->escaped(), $undoTooltip, array( - 'action' => 'edit', - 'undoafter' => $next->rev_id, - 'undo' => $rev->getId() + 'action' => 'edit', + 'undoafter' => $prevRev->getId(), + 'undo' => $rev->getId() ) ); $tools[] = "{$undolink}"; diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index c39f9de55c..08d977c40f 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -549,18 +549,14 @@ class ContribsPager extends ReverseChronologicalPager { } function doBatchLookups() { - global $wgRCShowChangedSize; - - $this->mParentLens = array(); - if ( $wgRCShowChangedSize ) { - $this->mResult->rewind(); - $revIds = array(); - foreach ( $this->mResult as $row ) { - $revIds[] = $row->rev_parent_id; - } - $this->mParentLens = $this->getParentLengths( $revIds ); - $this->mResult->rewind(); // reset + $this->mResult->rewind(); + $revIds = array(); + foreach ( $this->mResult as $row ) { + $revIds[] = $row->rev_parent_id; } + $this->mParentLens = $this->getParentLengths( $revIds ); + $this->mResult->rewind(); // reset + if ( $this->contribs === 'newbie' ) { // multiple users # Do a link batch query $this->mResult->seek( 0 ); -- 2.20.1