* Removed $wgRCShowChangedSize check in sp:Contributions for size diffs since this...
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 25 Oct 2011 18:19:26 +0000 (18:19 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 25 Oct 2011 18:19:26 +0000 (18:19 +0000)
* Replaced revision size information on history pages with size diff to be consistent with other places

includes/actions/HistoryAction.php
includes/specials/SpecialContributions.php

index 23e922e..3775bf1 100644 (file)
@@ -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[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
index c39f9de..08d977c 100644 (file)
@@ -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 );