Index: trunk/phase3/includes/Article.php |
— | — | @@ -2078,6 +2078,7 @@ |
2079 | 2079 | 'ar_text_id' => 'rev_text_id', |
2080 | 2080 | 'ar_text' => '\'\'', // Be explicit to appease |
2081 | 2081 | 'ar_flags' => '\'\'', // MySQL's "strict mode"... |
| 2082 | + 'ar_len' => 'rev_len' |
2082 | 2083 | ), array( |
2083 | 2084 | 'page_id' => $id, |
2084 | 2085 | 'page_id = rev_page' |
Index: trunk/phase3/includes/Revision.php |
— | — | @@ -11,7 +11,6 @@ |
12 | 12 | const DELETED_COMMENT = 2; |
13 | 13 | const DELETED_USER = 4; |
14 | 14 | const DELETED_RESTRICTED = 8; |
15 | | - const DELETED_NAME = 16; |
16 | 15 | |
17 | 16 | /** |
18 | 17 | * Load a page revision from a given revision ID number. |
— | — | @@ -317,7 +316,8 @@ |
318 | 317 | $this->mMinorEdit = isset( $row['minor_edit'] ) ? intval( $row['minor_edit'] ) : 0; |
319 | 318 | $this->mTimestamp = isset( $row['timestamp'] ) ? strval( $row['timestamp'] ) : wfTimestamp( TS_MW ); |
320 | 319 | $this->mDeleted = isset( $row['deleted'] ) ? intval( $row['deleted'] ) : 0; |
321 | | - |
| 320 | + $this->mSize = isset( $row['len'] ) ? intval( $row['len'] ) : 0; |
| 321 | + |
322 | 322 | // Enforce spacing trimming on supplied text |
323 | 323 | $this->mComment = isset( $row['comment'] ) ? trim( strval( $row['comment'] ) ) : null; |
324 | 324 | $this->mText = isset( $row['text'] ) ? rtrim( strval( $row['text'] ) ) : null; |
— | — | @@ -325,8 +325,9 @@ |
326 | 326 | |
327 | 327 | $this->mTitle = null; # Load on demand if needed |
328 | 328 | $this->mCurrent = false; |
329 | | - |
330 | | - $this->mSize = is_null($this->mText) ? null : strlen($this->mText); |
| 329 | + # If we still have no len_size, see it we have the text to figure it out |
| 330 | + if ( !$this->mSize ) |
| 331 | + $this->mSize = is_null($this->mText) ? null : strlen($this->mText); |
331 | 332 | } else { |
332 | 333 | throw new MWException( 'Revision constructor passed invalid row format.' ); |
333 | 334 | } |
— | — | @@ -711,7 +712,7 @@ |
712 | 713 | 'rev_user_text' => $this->mUserText, |
713 | 714 | 'rev_timestamp' => $dbw->timestamp( $this->mTimestamp ), |
714 | 715 | 'rev_deleted' => $this->mDeleted, |
715 | | - 'rev_len' => strlen($this->mText), |
| 716 | + 'rev_len' => ( $this->mSize ) ? $this->mSize : strlen($this->mText), |
716 | 717 | ), $fname |
717 | 718 | ); |
718 | 719 | |
Index: trunk/phase3/includes/SpecialUndelete.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | function listRevisions() { |
101 | 101 | $dbr = wfGetDB( DB_SLAVE ); |
102 | 102 | $res = $dbr->select( 'archive', |
103 | | - array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment' ), |
| 103 | + array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment', 'ar_len' ), |
104 | 104 | array( 'ar_namespace' => $this->title->getNamespace(), |
105 | 105 | 'ar_title' => $this->title->getDBkey() ), |
106 | 106 | 'PageArchive::listRevisions', |
— | — | @@ -170,7 +170,8 @@ |
171 | 171 | 'ar_timestamp', |
172 | 172 | 'ar_minor_edit', |
173 | 173 | 'ar_flags', |
174 | | - 'ar_text_id' ), |
| 174 | + 'ar_text_id', |
| 175 | + 'ar_len' ), |
175 | 176 | array( 'ar_namespace' => $this->title->getNamespace(), |
176 | 177 | 'ar_title' => $this->title->getDbkey(), |
177 | 178 | 'ar_timestamp' => $dbr->timestamp( $timestamp ) ), |
— | — | @@ -373,7 +374,8 @@ |
374 | 375 | 'ar_timestamp', |
375 | 376 | 'ar_minor_edit', |
376 | 377 | 'ar_flags', |
377 | | - 'ar_text_id' ), |
| 378 | + 'ar_text_id', |
| 379 | + 'ar_len' ), |
378 | 380 | /* WHERE */ array( |
379 | 381 | 'ar_namespace' => $this->title->getNamespace(), |
380 | 382 | 'ar_title' => $this->title->getDBkey(), |
— | — | @@ -413,6 +415,7 @@ |
414 | 416 | 'timestamp' => $row->ar_timestamp, |
415 | 417 | 'minor_edit' => $row->ar_minor_edit, |
416 | 418 | 'text_id' => $row->ar_text_id, |
| 419 | + 'len' => $row->ar_len |
417 | 420 | ) ); |
418 | 421 | $revision->insertOn( $dbw ); |
419 | 422 | $restored++; |
— | — | @@ -768,8 +771,14 @@ |
769 | 772 | $pageLink = $wgLang->timeanddate( $ts, true ); |
770 | 773 | } |
771 | 774 | $userLink = $sk->userLink( $row->ar_user, $row->ar_user_text ) . $sk->userToolLinks( $row->ar_user, $row->ar_user_text ); |
| 775 | + if (!is_null($size = $row->ar_len)) { |
| 776 | + if ($size == 0) |
| 777 | + $stxt = wfMsgHtml('historyempty'); |
| 778 | + else |
| 779 | + $stxt = wfMsgHtml('historysize', $wgLang->formatNum( $size ) ); |
| 780 | + } |
772 | 781 | $comment = $sk->commentBlock( $row->ar_comment ); |
773 | | - $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $comment</li>\n" ); |
| 782 | + $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $stxt $comment</li>\n" ); |
774 | 783 | |
775 | 784 | } |
776 | 785 | $revisions->free(); |