r111251 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111250‎ | r111251 | r111252 >
Date:18:11, 11 February 2012
Author:mah
Status:ok
Tags:
Comment:
fixes Bug 34198 - first item in the history shows no information about its size
Regression in 1.19 found and fixed by Umherirrender

With MediaWiki 1.19 the history page was changed from showing the
size to showing the diff and giving the size in the tooltip.

But now the first item in the history has no information about it size.
Modified paths:
  • /trunk/phase3/includes/actions/HistoryAction.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/actions/HistoryAction.php
@@ -385,8 +385,13 @@
386386 $this->mResult->seek( 0 );
387387 $batch = new LinkBatch();
388388 foreach ( $this->mResult as $row ) {
389 - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
390 - $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
 389+ if( !is_null( $row->user_name ) ) {
 390+ $batch->add( NS_USER, $row->user_name );
 391+ $batch->add( NS_USER_TALK, $row->user_name );
 392+ } else { # for anons or usernames of imported revisions
 393+ $batch->add( NS_USER, $row->rev_user_text );
 394+ $batch->add( NS_USER_TALK, $row->rev_user_text );
 395+ }
391396 }
392397 $batch->execute();
393398 $this->mResult->seek( 0 );
@@ -568,13 +573,10 @@
569574 $s .= ' ' . ChangesList::flag( 'minor' );
570575 }
571576
572 - if ( $prevRev
573 - && !$prevRev->isDeleted( Revision::DELETED_TEXT )
574 - && !$rev->isDeleted( Revision::DELETED_TEXT ) )
575 - {
576 - $sDiff = ChangesList::showCharacterDifference( $prevRev->getSize(), $rev->getSize() );
577 - $s .= ' . . ' . $sDiff . ' . . ';
578 - }
 577+ # Size is always public data
 578+ $prevSize = $prevRev ? $prevRev->getSize() : 0;
 579+ $sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() );
 580+ $s .= ' . . ' . $sDiff . ' . . ';
579581
580582 $s .= Linker::revComment( $rev, false, true );
581583
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -511,9 +511,9 @@
512512 $filterSelection .
513513 Xml::closeElement( 'tr' ) .
514514 Xml::openElement( 'tr' ) .
515 - $extraOptions .
516 - Xml::closeElement( 'tr' ) .
517 - Xml::openElement( 'tr' ) .
 515+ $extraOptions .
 516+ Xml::closeElement( 'tr' ) .
 517+ Xml::openElement( 'tr' ) .
518518 $dateSelectionAndSubmit .
519519 Xml::closeElement( 'tr' ) .
520520 Xml::closeElement( 'table' );
@@ -677,23 +677,26 @@
678678 $this->mResult->rewind();
679679 $revIds = array();
680680 foreach ( $this->mResult as $row ) {
681 - $revIds[] = $row->rev_parent_id;
 681+ if( $row->rev_parent_id ) {
 682+ $revIds[] = $row->rev_parent_id;
 683+ }
682684 }
683685 $this->mParentLens = $this->getParentLengths( $revIds );
684686 $this->mResult->rewind(); // reset
685687
686 - if ( $this->contribs === 'newbie' ) { // multiple users
687 - # Do a link batch query
688 - $this->mResult->seek( 0 );
689 - $batch = new LinkBatch();
690 - # Give some pointers to make (last) links
691 - foreach ( $this->mResult as $row ) {
692 - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
693 - $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
 688+ # Do a link batch query
 689+ $this->mResult->seek( 0 );
 690+ $batch = new LinkBatch();
 691+ # Give some pointers to make (last) links
 692+ foreach ( $this->mResult as $row ) {
 693+ if ( $this->contribs === 'newbie' ) { // multiple users
 694+ $batch->add( NS_USER, $row->user_name );
 695+ $batch->add( NS_USER_TALK, $row->user_name );
694696 }
695 - $batch->execute();
696 - $this->mResult->seek( 0 );
 697+ $batch->add( $row->page_namespace, $row->page_title );
697698 }
 699+ $batch->execute();
 700+ $this->mResult->seek( 0 );
698701 }
699702
700703 /**
@@ -789,12 +792,9 @@
790793 array( 'action' => 'history' )
791794 );
792795
793 - if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) {
794 - $chardiff = ' . . ' . ChangesList::showCharacterDifference(
795 - $this->mParentLens[$row->rev_parent_id], $row->rev_len ) . ' . . ';
796 - } else {
797 - $chardiff = ' ';
798 - }
 796+ $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? $this->mParentLens[$row->rev_parent_id] : 0;
 797+ $chardiff = ' . . ' . ChangesList::showCharacterDifference(
 798+ $parentLen, $row->rev_len ) . ' . . ';
799799
800800 $lang = $this->getLanguage();
801801 $comment = $lang->getDirMark() . Linker::revComment( $rev, false, true );

Follow-up revisions

RevisionCommit summaryAuthorDate
r111382MFT r111218, r111251reedy16:07, 13 February 2012

Status & tagging log