https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112995

Revision: 112995
Author:   bawolff
Date:     2012-03-05 00:51:47 +0000 (Mon, 05 Mar 2012)
Log Message:
-----------
(bug 34922) If rev_parent_id is null, then the character delta displayed on 
Special:Contributions is wrong. In that case instead just display "x bytes". 
Kind of sticks out, but better than a wrong number (possible alternative is 
just display no number at all)

No release notes since issue introduced in 1.19 and I'm going to tag this 
commit for merging.

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

Modified: trunk/phase3/includes/specials/SpecialContributions.php
===================================================================
--- trunk/phase3/includes/specials/SpecialContributions.php     2012-03-05 
00:27:28 UTC (rev 112994)
+++ trunk/phase3/includes/specials/SpecialContributions.php     2012-03-05 
00:51:47 UTC (rev 112995)
@@ -792,9 +792,16 @@
                        array( 'action' => 'history' )
                );
 
-               $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? 
$this->mParentLens[$row->rev_parent_id] : 0;
-               $chardiff = ' . . ' . ChangesList::showCharacterDifference(
-                               $parentLen, $row->rev_len ) . ' . . ';
+               if ( $row->rev_parent_id === null ) {
+                       // 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 = ' . . ' . Linker::formatRevisionSize( 
$row->rev_len ) . ' . . ';
+               } else {
+                       $parentLen = isset( 
$this->mParentLens[$row->rev_parent_id] ) ? 
$this->mParentLens[$row->rev_parent_id] : 0;
+                       $chardiff = ' . . ' . 
ChangesList::showCharacterDifference(
+                                       $parentLen, $row->rev_len ) . ' . . ';
+               }
 
                $lang = $this->getLanguage();
                $comment = $lang->getDirMark() . Linker::revComment( $rev, 
false, true );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to