Index: trunk/phase3/includes/Revision.php |
— | — | @@ -239,7 +239,8 @@ |
240 | 240 | 'rev_user', |
241 | 241 | 'rev_minor_edit', |
242 | 242 | 'rev_timestamp', |
243 | | - 'rev_deleted' ), |
| 243 | + 'rev_deleted', |
| 244 | + 'rev_len' ), |
244 | 245 | $conditions, |
245 | 246 | 'Revision::fetchRow', |
246 | 247 | array( 'LIMIT' => 1 ) ); |
— | — | @@ -263,6 +264,11 @@ |
264 | 265 | $this->mTimestamp = $row->rev_timestamp; |
265 | 266 | $this->mDeleted = intval( $row->rev_deleted ); |
266 | 267 | |
| 268 | + if (is_null($row->rev_len)) |
| 269 | + $this->mSize = null; |
| 270 | + else |
| 271 | + $this->mSize = intval( $row->rev_len ); |
| 272 | + |
267 | 273 | if( isset( $row->page_latest ) ) { |
268 | 274 | $this->mCurrent = ( $row->rev_id == $row->page_latest ); |
269 | 275 | $this->mTitle = Title::makeTitle( $row->page_namespace, |
— | — | @@ -300,6 +306,8 @@ |
301 | 307 | |
302 | 308 | $this->mTitle = null; # Load on demand if needed |
303 | 309 | $this->mCurrent = false; |
| 310 | + |
| 311 | + $this->mSize = is_null($this->mText) ? null : strlen($this->mText); |
304 | 312 | } else { |
305 | 313 | throw new MWException( 'Revision constructor passed invalid row format.' ); |
306 | 314 | } |
— | — | @@ -324,6 +332,13 @@ |
325 | 333 | } |
326 | 334 | |
327 | 335 | /** |
| 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 | + /** |
328 | 343 | * Returns the title of the page associated with this entry. |
329 | 344 | * @return Title |
330 | 345 | */ |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -219,6 +219,15 @@ |
220 | 220 | if( $row->rev_minor_edit ) { |
221 | 221 | $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') ); |
222 | 222 | } |
| 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 | + |
223 | 232 | #getComment is safe, but this is better formatted |
224 | 233 | if( $rev->isDeleted( Revision::DELETED_COMMENT ) ) { |
225 | 234 | $s .= " <span class=\"history-deleted\"><span class=\"comment\">" . |
— | — | @@ -379,7 +388,7 @@ |
380 | 389 | $res = $dbr->select( |
381 | 390 | 'revision', |
382 | 391 | 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'), |
384 | 393 | array_merge(array("rev_page=$page_id"), $offsets), |
385 | 394 | $fname, |
386 | 395 | array('ORDER BY' => "rev_timestamp $dirs", |
— | — | @@ -522,7 +531,7 @@ |
523 | 532 | return array( |
524 | 533 | 'tables' => 'revision', |
525 | 534 | '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'), |
527 | 536 | 'conds' => array('rev_page' => $this->mPageHistory->mTitle->getArticleID() ), |
528 | 537 | 'options' => array( 'USE INDEX' => 'page_timestamp' ) |
529 | 538 | ); |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1077,8 +1077,9 @@ |
1078 | 1078 | </div>', |
1079 | 1079 | #'rev-delundel' => 'del/undel', |
1080 | 1080 | 'rev-delundel' => 'show/hide', |
| 1081 | +'historysize' => '($1 bytes)', |
| 1082 | +'historyempty' => '(empty)', |
1081 | 1083 | |
1082 | | - |
1083 | 1084 | 'history-feed-title' => 'Revision history', |
1084 | 1085 | 'history-feed-description' => 'Revision history for this page on the wiki', |
1085 | 1086 | 'history-feed-item-nocomment' => '$1 at $2', # user at time |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -253,6 +253,7 @@ |
254 | 254 | * (bug 9097) column "pr_pagetype" does not exist |
255 | 255 | * (bug 9217) Balance wfProfile calls in Skin::outputPage |
256 | 256 | * (bug 9222) PostgreSQL updater should not be version-specific |
| 257 | +* (bug 1723) Article size in history |
257 | 258 | |
258 | 259 | == Languages updated == |
259 | 260 | |