Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -2014,6 +2014,8 @@ |
2015 | 2015 | 'sp-contributions-explain', |
2016 | 2016 | 'sp-contributions-footer', |
2017 | 2017 | 'sp-contributions-footer-anon', |
| 2018 | + 'sp-contributions-showsizediff', |
| 2019 | + 'sp-contributions-showsizediff-warn', |
2018 | 2020 | ), |
2019 | 2021 | 'whatlinkshere' => array( |
2020 | 2022 | 'whatlinkshere', |
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 ) { |
— | — | @@ -132,6 +133,7 @@ |
133 | 134 | 'month' => $this->opts['month'], |
134 | 135 | 'deletedOnly' => $this->opts['deletedOnly'], |
135 | 136 | 'topOnly' => $this->opts['topOnly'], |
| 137 | + 'showSizeDiff' => $this->opts['showSizeDiff'], |
136 | 138 | ) ); |
137 | 139 | if( !$pager->getNumRows() ) { |
138 | 140 | $wgOut->addWikiMsg( 'nocontribs', $target ); |
— | — | @@ -317,7 +319,7 @@ |
318 | 320 | * @return String: HTML fragment |
319 | 321 | */ |
320 | 322 | protected function getForm() { |
321 | | - global $wgScript, $wgMiserMode; |
| 323 | + global $wgScript, $wgMiserMode, $wgRCMaxAge, $wgContLang; |
322 | 324 | |
323 | 325 | $this->opts['title'] = $this->getTitle()->getPrefixedText(); |
324 | 326 | if( !isset( $this->opts['target'] ) ) { |
— | — | @@ -354,10 +356,14 @@ |
355 | 357 | $this->opts['topOnly'] = false; |
356 | 358 | } |
357 | 359 | |
| 360 | + if( !isset( $this->opts['showSizeDiff'] ) ) { |
| 361 | + $this->opts['showSizeDiff'] = !$wgMiserMode; |
| 362 | + } |
| 363 | + |
358 | 364 | $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) ); |
359 | 365 | |
360 | 366 | # Add hidden params for tracking except for parameters in $skipParameters |
361 | | - $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly' ); |
| 367 | + $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'showSizeDiff' ); |
362 | 368 | foreach ( $this->opts as $name => $value ) { |
363 | 369 | if( in_array( $name, $skipParameters ) ) { |
364 | 370 | continue; |
— | — | @@ -366,13 +372,21 @@ |
367 | 373 | } |
368 | 374 | |
369 | 375 | $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagFilter'] ); |
| 376 | + |
| 377 | + $fNS = ''; |
| 378 | + $fShowDiff = ''; |
| 379 | + if ( !$wgMiserMode ) { |
| 380 | + $fNS = Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), |
| 381 | + Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' . |
| 382 | + Xml::namespaceSelector( $this->opts['namespace'], '' ) |
| 383 | + ); |
| 384 | + $fShowDiff = Xml::infoBox( |
| 385 | + Xml::checkLabel( wfMsg( 'sp-contributions-showsizediff' ), 'showSizeDiff', 'mw-show-size-diff', $this->opts['showSizeDiff'] ) . '<br />'. |
| 386 | + wfMsgReplaceArgs ( wfMsg( 'sp-contributions-showsizediff-warn' ), array( $wgContLang->formatTimePeriod( $wgRCMaxAge ) ) ) |
| 387 | + , 'warning-32.png', wfMsg( 'sp-contributions-showsizediff' ) |
| 388 | + ); |
| 389 | + } |
370 | 390 | |
371 | | - $fNS = ( $wgMiserMode ) ? '' : |
372 | | - Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), |
373 | | - Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' . |
374 | | - Xml::namespaceSelector( $this->opts['namespace'], '' ) |
375 | | - ); |
376 | | - |
377 | 391 | $f .= Xml::fieldset( wfMsg( 'sp-contributions-search' ) ) . |
378 | 392 | Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parsemag' ) ), |
379 | 393 | 'contribs', 'newbie' , 'newbie', $this->opts['contribs'] == 'newbie' ) . '<br />' . |
— | — | @@ -387,6 +401,7 @@ |
388 | 402 | 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) . '<br />' . |
389 | 403 | Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'sp-contributions-toponly' ), |
390 | 404 | 'topOnly', 'mw-show-top-only', $this->opts['topOnly'] ) ) . |
| 405 | + $fShowDiff. |
391 | 406 | ( $tagFilter ? Xml::tags( 'p', null, implode( ' ', $tagFilter ) ) : '' ) . |
392 | 407 | Html::rawElement( 'p', array( 'style' => 'white-space: nowrap' ), |
393 | 408 | Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) . ' ' . |
— | — | @@ -436,6 +451,7 @@ |
437 | 452 | 'tagFilter' => $this->opts['tagFilter'], |
438 | 453 | 'deletedOnly' => $this->opts['deletedOnly'], |
439 | 454 | 'topOnly' => $this->opts['topOnly'], |
| 455 | + 'showSizeDiff' => $this->opts['showSizeDiff'], |
440 | 456 | ) ); |
441 | 457 | |
442 | 458 | $pager->mLimit = min( $this->opts['limit'], $wgFeedLimit ); |
— | — | @@ -523,6 +539,7 @@ |
524 | 540 | |
525 | 541 | $this->deletedOnly = !empty( $options['deletedOnly'] ); |
526 | 542 | $this->topOnly = !empty( $options['topOnly'] ); |
| 543 | + $this->showSizeDiff = !empty( $options['showSizeDiff'] ); |
527 | 544 | |
528 | 545 | $year = isset( $options['year'] ) ? $options['year'] : false; |
529 | 546 | $month = isset( $options['month'] ) ? $options['month'] : false; |
— | — | @@ -538,7 +555,7 @@ |
539 | 556 | } |
540 | 557 | |
541 | 558 | function getQueryInfo() { |
542 | | - global $wgUser; |
| 559 | + global $wgUser, $wgMiserMode; |
543 | 560 | list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond(); |
544 | 561 | |
545 | 562 | $conds = array_merge( $userCond, $this->getNamespaceCond() ); |
— | — | @@ -550,20 +567,25 @@ |
551 | 568 | ' != ' . Revision::SUPPRESSED_USER; |
552 | 569 | } |
553 | 570 | $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' ); |
| 571 | + |
| 572 | + $fields = array( |
| 573 | + 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect', |
| 574 | + 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', |
| 575 | + 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted' |
| 576 | + ); |
| 577 | + if ( $this->showSizeDiff && !$wgMiserMode ) { |
| 578 | + $fields = array_merge( $fields, array( 'rc_old_len', 'rc_new_len' ) ); |
| 579 | + array_unshift( $tables, 'recentchanges' ); |
| 580 | + $join_cond['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid" ); |
| 581 | + } |
554 | 582 | |
555 | 583 | $queryInfo = array( |
556 | 584 | 'tables' => $tables, |
557 | | - 'fields' => array( |
558 | | - 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect', |
559 | | - 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', |
560 | | - 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted', |
561 | | - 'rc_old_len', 'rc_new_len' |
562 | | - ), |
| 585 | + 'fields' => $fields, |
563 | 586 | 'conds' => $conds, |
564 | 587 | 'options' => array( 'USE INDEX' => array('revision' => $index) ), |
565 | 588 | 'join_conds' => $join_cond |
566 | 589 | ); |
567 | | - |
568 | 590 | ChangeTags::modifyDisplayQuery( |
569 | 591 | $queryInfo['tables'], |
570 | 592 | $queryInfo['fields'], |
— | — | @@ -580,19 +602,18 @@ |
581 | 603 | function getUserCond() { |
582 | 604 | $condition = array(); |
583 | 605 | $join_conds = array(); |
| 606 | + |
584 | 607 | if( $this->target == 'newbies' ) { |
585 | | - $tables = array( 'recentchanges', 'user_groups', 'page', 'revision' ); |
| 608 | + $tables = array( 'user_groups', 'page', 'revision' ); |
586 | 609 | $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ ); |
587 | 610 | $condition[] = 'rev_user >' . (int)($max - $max / 100); |
588 | 611 | $condition[] = 'ug_group IS NULL'; |
589 | 612 | $index = 'user_timestamp'; |
590 | 613 | # FIXME: other groups may have 'bot' rights |
591 | 614 | $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" ); |
592 | | - $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid" ); |
593 | 615 | } else { |
594 | | - $tables = array( 'recentchanges', 'page', 'revision' ); |
| 616 | + $tables = array( 'page', 'revision' ); |
595 | 617 | $condition['rev_user_text'] = $this->target; |
596 | | - $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid" ); |
597 | 618 | $index = 'usertext_timestamp'; |
598 | 619 | } |
599 | 620 | if( $this->deletedOnly ) { |
— | — | @@ -739,7 +760,8 @@ |
740 | 761 | |
741 | 762 | $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')'; |
742 | 763 | |
743 | | - $diffOut = ' . . '.ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ); |
| 764 | + |
| 765 | + $diffOut = ( $this->showSizeDiff ) ? ' . . '.ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ) : ''; |
744 | 766 | |
745 | 767 | $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}"; |
746 | 768 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2992,6 +2992,8 @@ |
2993 | 2993 | 'sp-contributions-search' => 'Search for contributions', |
2994 | 2994 | 'sp-contributions-username' => 'IP address or username:', |
2995 | 2995 | 'sp-contributions-toponly' => 'Only show edits that are latest revisions', |
| 2996 | +'sp-contributions-showsizediff' => 'Display difference in page size', |
| 2997 | +'sp-contributions-showsizediff-warn' => 'This instance has recent changes log limited to $1 . If you use this option, pages not in this log will not be displayed', |
2996 | 2998 | 'sp-contributions-submit' => 'Search', |
2997 | 2999 | 'sp-contributions-explain' => '', # only translate this message to other languages if you have to change it |
2998 | 3000 | 'sp-contributions-footer' => '-', # do not translate or duplicate this message to other languages |