From: River Tarnell Date: Thu, 8 Mar 2007 03:07:58 +0000 (+0000) Subject: * (bug 1723) Article size in history X-Git-Tag: 1.31.0-rc.0~53862 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=a4003cf25319d7e507f3b69ce1c76218ca0f026b;p=lhc%2Fweb%2Fwiklou.git * (bug 1723) Article size in history --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9a254c27f9..095a89ad03 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -253,6 +253,7 @@ lighter making things easier to read. * (bug 9097) column "pr_pagetype" does not exist * (bug 9217) Balance wfProfile calls in Skin::outputPage * (bug 9222) PostgreSQL updater should not be version-specific +* (bug 1723) Article size in history == Languages updated == diff --git a/includes/PageHistory.php b/includes/PageHistory.php index b397e8cb08..2c035c3269 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -219,6 +219,15 @@ class PageHistory { if( $row->rev_minor_edit ) { $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') ); } + + if (!is_null($size = $rev->getSize())) { + if ($size == 0) + $stxt = wfMsgHtml('historyempty'); + else + $stxt = wfMsgHtml('historysize', $size); + $s .= " $stxt"; + } + #getComment is safe, but this is better formatted if( $rev->isDeleted( Revision::DELETED_COMMENT ) ) { $s .= " " . @@ -379,7 +388,7 @@ class PageHistory { $res = $dbr->select( 'revision', array('rev_id', 'rev_page', 'rev_text_id', 'rev_user', 'rev_comment', 'rev_user_text', - 'rev_timestamp', 'rev_minor_edit', 'rev_deleted'), + 'rev_timestamp', 'rev_minor_edit', 'rev_deleted', 'rev_len'), array_merge(array("rev_page=$page_id"), $offsets), $fname, array('ORDER BY' => "rev_timestamp $dirs", @@ -522,7 +531,7 @@ class PageHistoryPager extends ReverseChronologicalPager { return array( 'tables' => 'revision', 'fields' => array('rev_id', 'rev_page', 'rev_text_id', 'rev_user', 'rev_comment', 'rev_user_text', - 'rev_timestamp', 'rev_minor_edit', 'rev_deleted'), + 'rev_timestamp', 'rev_minor_edit', 'rev_deleted', 'rev_len'), 'conds' => array('rev_page' => $this->mPageHistory->mTitle->getArticleID() ), 'options' => array( 'USE INDEX' => 'page_timestamp' ) ); diff --git a/includes/Revision.php b/includes/Revision.php index 7526a54f07..3dcb471781 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -239,7 +239,8 @@ class Revision { 'rev_user', 'rev_minor_edit', 'rev_timestamp', - 'rev_deleted' ), + 'rev_deleted', + 'rev_len' ), $conditions, 'Revision::fetchRow', array( 'LIMIT' => 1 ) ); @@ -263,6 +264,11 @@ class Revision { $this->mTimestamp = $row->rev_timestamp; $this->mDeleted = intval( $row->rev_deleted ); + if (is_null($row->rev_len)) + $this->mSize = null; + else + $this->mSize = intval( $row->rev_len ); + if( isset( $row->page_latest ) ) { $this->mCurrent = ( $row->rev_id == $row->page_latest ); $this->mTitle = Title::makeTitle( $row->page_namespace, @@ -300,6 +306,8 @@ class Revision { $this->mTitle = null; # Load on demand if needed $this->mCurrent = false; + + $this->mSize = is_null($this->mText) ? null : strlen($this->mText); } else { throw new MWException( 'Revision constructor passed invalid row format.' ); } @@ -323,6 +331,13 @@ class Revision { return $this->mTextId; } + /** + * Returns the length of the text in this revision, or null if unknown. + */ + function getSize() { + return $this->mSize; + } + /** * Returns the title of the page associated with this entry. * @return Title diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 8853737e2e..a72792532f 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1077,7 +1077,8 @@ there may be details in the [{{fullurl:Special:Log/delete|page={{PAGENAMEE}}}} d ', #'rev-delundel' => 'del/undel', 'rev-delundel' => 'show/hide', - +'historysize' => '($1 bytes)', +'historyempty' => '(empty)', 'history-feed-title' => 'Revision history', 'history-feed-description' => 'Revision history for this page on the wiki',