http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100722

Revision: 100722
Author:   aaron
Date:     2011-10-25 18:19:26 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
* 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

Modified Paths:
--------------
    trunk/phase3/includes/actions/HistoryAction.php
    trunk/phase3/includes/specials/SpecialContributions.php

Modified: trunk/phase3/includes/actions/HistoryAction.php
===================================================================
--- trunk/phase3/includes/actions/HistoryAction.php     2011-10-25 18:16:41 UTC 
(rev 100721)
+++ trunk/phase3/includes/actions/HistoryAction.php     2011-10-25 18:19:26 UTC 
(rev 100722)
@@ -498,7 +498,7 @@
         * @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 @@
                $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 @@
                        $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 @@
                $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 @@
                        }
 
                        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 @@
                                        $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>";

Modified: trunk/phase3/includes/specials/SpecialContributions.php
===================================================================
--- trunk/phase3/includes/specials/SpecialContributions.php     2011-10-25 
18:16:41 UTC (rev 100721)
+++ trunk/phase3/includes/specials/SpecialContributions.php     2011-10-25 
18:19:26 UTC (rev 100722)
@@ -549,18 +549,14 @@
        }
 
        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 );


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to