r20221 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20220‎ | r20221 | r20222 >
Date:03:07, 8 March 2007
Author:river
Status:old
Tags:
Comment:
* (bug 1723) Article size in history
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Revision.php
@@ -239,7 +239,8 @@
240240 'rev_user',
241241 'rev_minor_edit',
242242 'rev_timestamp',
243 - 'rev_deleted' ),
 243+ 'rev_deleted',
 244+ 'rev_len' ),
244245 $conditions,
245246 'Revision::fetchRow',
246247 array( 'LIMIT' => 1 ) );
@@ -263,6 +264,11 @@
264265 $this->mTimestamp = $row->rev_timestamp;
265266 $this->mDeleted = intval( $row->rev_deleted );
266267
 268+ if (is_null($row->rev_len))
 269+ $this->mSize = null;
 270+ else
 271+ $this->mSize = intval( $row->rev_len );
 272+
267273 if( isset( $row->page_latest ) ) {
268274 $this->mCurrent = ( $row->rev_id == $row->page_latest );
269275 $this->mTitle = Title::makeTitle( $row->page_namespace,
@@ -300,6 +306,8 @@
301307
302308 $this->mTitle = null; # Load on demand if needed
303309 $this->mCurrent = false;
 310+
 311+ $this->mSize = is_null($this->mText) ? null : strlen($this->mText);
304312 } else {
305313 throw new MWException( 'Revision constructor passed invalid row format.' );
306314 }
@@ -324,6 +332,13 @@
325333 }
326334
327335 /**
 336+ * Returns the length of the text in this revision, or null if unknown.
 337+ */
 338+ function getSize() {
 339+ return $this->mSize;
 340+ }
 341+
 342+ /**
328343 * Returns the title of the page associated with this entry.
329344 * @return Title
330345 */
Index: trunk/phase3/includes/PageHistory.php
@@ -219,6 +219,15 @@
220220 if( $row->rev_minor_edit ) {
221221 $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') );
222222 }
 223+
 224+ if (!is_null($size = $rev->getSize())) {
 225+ if ($size == 0)
 226+ $stxt = wfMsgHtml('historyempty');
 227+ else
 228+ $stxt = wfMsgHtml('historysize', $size);
 229+ $s .= " <span class=\"history-size\">$stxt</span>";
 230+ }
 231+
223232 #getComment is safe, but this is better formatted
224233 if( $rev->isDeleted( Revision::DELETED_COMMENT ) ) {
225234 $s .= " <span class=\"history-deleted\"><span class=\"comment\">" .
@@ -379,7 +388,7 @@
380389 $res = $dbr->select(
381390 'revision',
382391 array('rev_id', 'rev_page', 'rev_text_id', 'rev_user', 'rev_comment', 'rev_user_text',
383 - 'rev_timestamp', 'rev_minor_edit', 'rev_deleted'),
 392+ 'rev_timestamp', 'rev_minor_edit', 'rev_deleted', 'rev_len'),
384393 array_merge(array("rev_page=$page_id"), $offsets),
385394 $fname,
386395 array('ORDER BY' => "rev_timestamp $dirs",
@@ -522,7 +531,7 @@
523532 return array(
524533 'tables' => 'revision',
525534 'fields' => array('rev_id', 'rev_page', 'rev_text_id', 'rev_user', 'rev_comment', 'rev_user_text',
526 - 'rev_timestamp', 'rev_minor_edit', 'rev_deleted'),
 535+ 'rev_timestamp', 'rev_minor_edit', 'rev_deleted', 'rev_len'),
527536 'conds' => array('rev_page' => $this->mPageHistory->mTitle->getArticleID() ),
528537 'options' => array( 'USE INDEX' => 'page_timestamp' )
529538 );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1077,8 +1077,9 @@
10781078 </div>',
10791079 #'rev-delundel' => 'del/undel',
10801080 'rev-delundel' => 'show/hide',
 1081+'historysize' => '($1 bytes)',
 1082+'historyempty' => '(empty)',
10811083
1082 -
10831084 'history-feed-title' => 'Revision history',
10841085 'history-feed-description' => 'Revision history for this page on the wiki',
10851086 'history-feed-item-nocomment' => '$1 at $2', # user at time
Index: trunk/phase3/RELEASE-NOTES
@@ -253,6 +253,7 @@
254254 * (bug 9097) column "pr_pagetype" does not exist
255255 * (bug 9217) Balance wfProfile calls in Skin::outputPage
256256 * (bug 9222) PostgreSQL updater should not be version-specific
 257+* (bug 1723) Article size in history
257258
258259 == Languages updated ==
259260