Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -69,6 +69,7 @@ |
70 | 70 | $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') ); |
71 | 71 | $this->opts['target'] = $target; |
72 | 72 | $this->opts['topOnly'] = $wgRequest->getBool( 'topOnly' ); |
| 73 | + $this->opts['showSizeDiff'] = $wgRequest->getBool( 'showSizeDiff' ); |
73 | 74 | |
74 | 75 | $nt = Title::makeTitleSafe( NS_USER, $target ); |
75 | 76 | if( !$nt ) { |
— | — | @@ -126,6 +127,9 @@ |
127 | 128 | if ( $this->opts['topOnly'] ) { |
128 | 129 | $apiParams['toponly'] = true; |
129 | 130 | } |
| 131 | + if ( $this->opts['showSizeDiff'] ) { |
| 132 | + $apiParams['showsizediff'] = true; |
| 133 | + } |
130 | 134 | if ( $this->opts['deletedOnly'] ) { |
131 | 135 | $apiParams['deletedonly'] = true; |
132 | 136 | } |
— | — | @@ -162,6 +166,7 @@ |
163 | 167 | 'month' => $this->opts['month'], |
164 | 168 | 'deletedOnly' => $this->opts['deletedOnly'], |
165 | 169 | 'topOnly' => $this->opts['topOnly'], |
| 170 | + 'showSizeDiff' => $this->opts['showSizeDiff'], |
166 | 171 | ) ); |
167 | 172 | if( !$pager->getNumRows() ) { |
168 | 173 | $wgOut->addWikiMsg( 'nocontribs', $target ); |
— | — | @@ -375,10 +380,14 @@ |
376 | 381 | $this->opts['topOnly'] = false; |
377 | 382 | } |
378 | 383 | |
| 384 | + if( !isset( $this->opts['showSizeDiff'] ) ) { |
| 385 | + $this->opts['showSizeDiff'] = !$wgMiserMode; |
| 386 | + } |
| 387 | + |
379 | 388 | $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) ); |
380 | 389 | |
381 | 390 | # Add hidden params for tracking except for parameters in $skipParameters |
382 | | - $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly' ); |
| 391 | + $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'showSizeDiff' ); |
383 | 392 | foreach ( $this->opts as $name => $value ) { |
384 | 393 | if( in_array( $name, $skipParameters ) ) { |
385 | 394 | continue; |
— | — | @@ -389,10 +398,13 @@ |
390 | 399 | $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagFilter'] ); |
391 | 400 | |
392 | 401 | $fNS = ''; |
| 402 | + $fShowDiff = ''; |
393 | 403 | if ( !$wgMiserMode ) { |
394 | 404 | $fNS = Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), |
395 | | - Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' . Xml::namespaceSelector( $this->opts['namespace'], '' ) |
396 | | - ); |
| 405 | + Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' . |
| 406 | + Xml::namespaceSelector( $this->opts['namespace'], '' ) |
| 407 | + ); |
| 408 | + $fShowDiff = Xml::checkLabel( wfMsg( 'sp-contributions-showsizediff' ), 'showSizeDiff', 'mw-show-size-diff', $this->opts['showSizeDiff'] ); |
397 | 409 | } |
398 | 410 | |
399 | 411 | $f .= Xml::fieldset( wfMsg( 'sp-contributions-search' ) ) . |
— | — | @@ -409,6 +421,7 @@ |
410 | 422 | 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) . '<br />' . |
411 | 423 | Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'sp-contributions-toponly' ), |
412 | 424 | 'topOnly', 'mw-show-top-only', $this->opts['topOnly'] ) ) . |
| 425 | + $fShowDiff. |
413 | 426 | ( $tagFilter ? Xml::tags( 'p', null, implode( ' ', $tagFilter ) ) : '' ) . |
414 | 427 | Html::rawElement( 'p', array( 'style' => 'white-space: nowrap' ), |
415 | 428 | Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) . ' ' . |
— | — | @@ -449,6 +462,7 @@ |
450 | 463 | |
451 | 464 | $this->deletedOnly = !empty( $options['deletedOnly'] ); |
452 | 465 | $this->topOnly = !empty( $options['topOnly'] ); |
| 466 | + $this->showSizeDiff = !empty( $options['showSizeDiff'] ); |
453 | 467 | |
454 | 468 | $year = isset( $options['year'] ) ? $options['year'] : false; |
455 | 469 | $month = isset( $options['month'] ) ? $options['month'] : false; |
— | — | @@ -468,7 +482,7 @@ |
469 | 483 | } |
470 | 484 | |
471 | 485 | function getQueryInfo() { |
472 | | - global $wgUser; |
| 486 | + global $wgUser, $wgMiserMode; |
473 | 487 | list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond(); |
474 | 488 | |
475 | 489 | $conds = array_merge( $userCond, $this->getNamespaceCond() ); |
— | — | @@ -481,14 +495,21 @@ |
482 | 496 | } |
483 | 497 | $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' ); |
484 | 498 | |
| 499 | + $fields = array( |
| 500 | + 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect', |
| 501 | + 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', |
| 502 | + 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted', |
| 503 | + 'rev_len' |
| 504 | + ); |
| 505 | + if ( $this->showSizeDiff && !$wgMiserMode ) { |
| 506 | + $fields = array_merge( $fields, array( 'rc_old_len', 'rc_new_len' ) ); |
| 507 | + array_unshift( $tables, 'recentchanges' ); |
| 508 | + $join_cond['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid" ); |
| 509 | + } |
| 510 | + |
485 | 511 | $queryInfo = array( |
486 | 512 | 'tables' => $tables, |
487 | | - 'fields' => array( |
488 | | - 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect', |
489 | | - 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', |
490 | | - 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted', |
491 | | - 'rc_old_len', 'rc_new_len' |
492 | | - ), |
| 513 | + 'fields' => $fields, |
493 | 514 | 'conds' => $conds, |
494 | 515 | 'options' => array( 'USE INDEX' => array('revision' => $index) ), |
495 | 516 | 'join_conds' => $join_cond |
— | — | @@ -511,7 +532,7 @@ |
512 | 533 | $join_conds = array(); |
513 | 534 | |
514 | 535 | if( $this->target == 'newbies' ) { |
515 | | - $tables = array( 'recentchanges', 'user_groups', 'page', 'revision' ); |
| 536 | + $tables = array( 'user_groups', 'page', 'revision' ); |
516 | 537 | $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ ); |
517 | 538 | $condition[] = 'rev_user >' . (int)($max - $max / 100); |
518 | 539 | $condition[] = 'ug_group IS NULL'; |
— | — | @@ -520,7 +541,7 @@ |
521 | 542 | $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" ); |
522 | 543 | $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid AND rev_timestamp = rc_timestamp" ); |
523 | 544 | } else { |
524 | | - $tables = array( 'recentchanges', 'page', 'revision' ); |
| 545 | + $tables = array( 'page', 'revision' ); |
525 | 546 | $condition['rev_user_text'] = $this->target; |
526 | 547 | $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid AND rev_timestamp = rc_timestamp" ); |
527 | 548 | $index = 'usertext_timestamp'; |
— | — | @@ -669,9 +690,10 @@ |
670 | 691 | |
671 | 692 | $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')'; |
672 | 693 | |
673 | | - $diffOut = ' . . ' . $wgLang->getDirMark() . |
674 | | - ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ); |
675 | 694 | |
| 695 | + $diffOut = ' . . ' . $wgLang->getDirMark() . ( $this->showSizeDiff ? |
| 696 | + ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ) : Linker::formatRevisionSize( $row->rev_len ) ); |
| 697 | + |
676 | 698 | $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}"; |
677 | 699 | |
678 | 700 | # Denote if username is redacted for this edit |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3006,6 +3006,7 @@ |
3007 | 3007 | 'sp-contributions-explain' => '', # only translate this message to other languages if you have to change it |
3008 | 3008 | 'sp-contributions-footer' => '-', # do not translate or duplicate this message to other languages |
3009 | 3009 | 'sp-contributions-footer-anon' => '-', # do not translate or duplicate this message to other languages |
| 3010 | +'sp-contributions-showsizediff' => 'Display difference in page size', |
3010 | 3011 | |
3011 | 3012 | # What links here |
3012 | 3013 | 'whatlinkshere' => 'What links here', |
Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -2032,6 +2032,7 @@ |
2033 | 2033 | 'sp-contributions-explain', |
2034 | 2034 | 'sp-contributions-footer', |
2035 | 2035 | 'sp-contributions-footer-anon', |
| 2036 | + 'sp-contributions-showsizediff', |
2036 | 2037 | ), |
2037 | 2038 | 'whatlinkshere' => array( |
2038 | 2039 | 'whatlinkshere', |