From f2ab4aceeb73c1d3671c973ec5143dde672677a1 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Sat, 11 Feb 2012 18:11:01 +0000 Subject: [PATCH] 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. --- includes/actions/HistoryAction.php | 20 ++++++----- includes/specials/SpecialContributions.php | 40 +++++++++++----------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index d64d3cb4bc..0d82c33574 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -385,8 +385,13 @@ class HistoryPager extends ReverseChronologicalPager { $this->mResult->seek( 0 ); $batch = new LinkBatch(); foreach ( $this->mResult as $row ) { - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); - $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); + if( !is_null( $row->user_name ) ) { + $batch->add( NS_USER, $row->user_name ); + $batch->add( NS_USER_TALK, $row->user_name ); + } else { # for anons or usernames of imported revisions + $batch->add( NS_USER, $row->rev_user_text ); + $batch->add( NS_USER_TALK, $row->rev_user_text ); + } } $batch->execute(); $this->mResult->seek( 0 ); @@ -568,13 +573,10 @@ class HistoryPager extends ReverseChronologicalPager { $s .= ' ' . ChangesList::flag( 'minor' ); } - if ( $prevRev - && !$prevRev->isDeleted( Revision::DELETED_TEXT ) - && !$rev->isDeleted( Revision::DELETED_TEXT ) ) - { - $sDiff = ChangesList::showCharacterDifference( $prevRev->getSize(), $rev->getSize() ); - $s .= ' . . ' . $sDiff . ' . . '; - } + # Size is always public data + $prevSize = $prevRev ? $prevRev->getSize() : 0; + $sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() ); + $s .= ' . . ' . $sDiff . ' . . '; $s .= Linker::revComment( $rev, false, true ); diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index f538abb68a..3471003199 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -511,9 +511,9 @@ class SpecialContributions extends SpecialPage { $filterSelection . Xml::closeElement( 'tr' ) . Xml::openElement( 'tr' ) . - $extraOptions . - Xml::closeElement( 'tr' ) . - Xml::openElement( 'tr' ) . + $extraOptions . + Xml::closeElement( 'tr' ) . + Xml::openElement( 'tr' ) . $dateSelectionAndSubmit . Xml::closeElement( 'tr' ) . Xml::closeElement( 'table' ); @@ -677,23 +677,26 @@ class ContribsPager extends ReverseChronologicalPager { $this->mResult->rewind(); $revIds = array(); foreach ( $this->mResult as $row ) { - $revIds[] = $row->rev_parent_id; + if( $row->rev_parent_id ) { + $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 ); - $batch = new LinkBatch(); - # Give some pointers to make (last) links - foreach ( $this->mResult as $row ) { - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); - $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); + # Do a link batch query + $this->mResult->seek( 0 ); + $batch = new LinkBatch(); + # Give some pointers to make (last) links + foreach ( $this->mResult as $row ) { + if ( $this->contribs === 'newbie' ) { // multiple users + $batch->add( NS_USER, $row->user_name ); + $batch->add( NS_USER_TALK, $row->user_name ); } - $batch->execute(); - $this->mResult->seek( 0 ); + $batch->add( $row->page_namespace, $row->page_title ); } + $batch->execute(); + $this->mResult->seek( 0 ); } /** @@ -789,12 +792,9 @@ class ContribsPager extends ReverseChronologicalPager { array( 'action' => 'history' ) ); - if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) { - $chardiff = ' . . ' . ChangesList::showCharacterDifference( - $this->mParentLens[$row->rev_parent_id], $row->rev_len ) . ' . . '; - } else { - $chardiff = ' '; - } + $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 ); -- 2.20.1