| Index: trunk/phase3/includes/specials/SpecialContributions.php |
| — | — | @@ -485,7 +485,8 @@ |
| 486 | 486 | 'fields' => array( |
| 487 | 487 | 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect', |
| 488 | 488 | 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', |
| 489 | | - 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted' |
| | 489 | + 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted', |
| | 490 | + 'rev_len', 'rev_parent_id' |
| 490 | 491 | ), |
| 491 | 492 | 'conds' => $conds, |
| 492 | 493 | 'options' => array( 'USE INDEX' => array('revision' => $index) ), |
| — | — | @@ -551,6 +552,44 @@ |
| 552 | 553 | return "</ul>\n"; |
| 553 | 554 | } |
| 554 | 555 | |
| | 556 | + function getBody() { |
| | 557 | + global $wgRCShowChangedSize; |
| | 558 | + if( !$this->mQueryDone ) { |
| | 559 | + $this->doQuery(); |
| | 560 | + } |
| | 561 | + $this->mParentLens = array(); |
| | 562 | + if( $wgRCShowChangedSize ) { |
| | 563 | + $this->mResult->rewind(); |
| | 564 | + $revIds = array(); |
| | 565 | + foreach( $this->mResult as $row ) { |
| | 566 | + $revIds[] = $row->rev_parent_id; |
| | 567 | + } |
| | 568 | + $this->mParentLens = $this->getParentLengths( $revIds ); |
| | 569 | + $this->mResult->rewind(); |
| | 570 | + } |
| | 571 | + return parent::getBody(); |
| | 572 | + } |
| | 573 | + |
| | 574 | + /* |
| | 575 | + * Do a batched query to get the parent revision lengths |
| | 576 | + */ |
| | 577 | + private function getParentLengths( array $revIds ) { |
| | 578 | + $revLens = array(); |
| | 579 | + if ( !$revIds ) { |
| | 580 | + return $revLens; // empty |
| | 581 | + } |
| | 582 | + wfProfileIn( __METHOD__ ); |
| | 583 | + $res = $this->getDatabase()->select( 'revision', |
| | 584 | + array( 'rev_id', 'rev_len' ), |
| | 585 | + array( 'rev_id' => $revIds ), |
| | 586 | + __METHOD__ ); |
| | 587 | + foreach( $res as $row ) { |
| | 588 | + $revLens[$row->rev_id] = $row->rev_len; |
| | 589 | + } |
| | 590 | + wfProfileOut( __METHOD__ ); |
| | 591 | + return $revLens; |
| | 592 | + } |
| | 593 | + |
| 555 | 594 | /** |
| 556 | 595 | * Generates each row in the contributions list. |
| 557 | 596 | * |
| — | — | @@ -609,6 +648,13 @@ |
| 610 | 649 | array( 'action' => 'history' ) |
| 611 | 650 | ); |
| 612 | 651 | |
| | 652 | + if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) { |
| | 653 | + $chardiff = ' . . ' . ChangesList::showCharacterDifference( |
| | 654 | + $this->mParentLens[$row->rev_parent_id], $row->rev_len ) . ' . . '; |
| | 655 | + } else { |
| | 656 | + $chardiff = ''; |
| | 657 | + } |
| | 658 | + |
| 613 | 659 | $comment = $wgLang->getDirMark() . $sk->revComment( $rev, false, true ); |
| 614 | 660 | $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true ); |
| 615 | 661 | if( $rev->userCan( Revision::DELETED_TEXT ) ) { |
| — | — | @@ -664,7 +710,7 @@ |
| 665 | 711 | } |
| 666 | 712 | |
| 667 | 713 | $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')'; |
| 668 | | - $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}"; |
| | 714 | + $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag}{$chardiff} {$link}{$userlink} {$comment} {$topmarktext}"; |
| 669 | 715 | |
| 670 | 716 | # Denote if username is redacted for this edit |
| 671 | 717 | if( $rev->isDeleted( Revision::DELETED_USER ) ) { |