r96090 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96089‎ | r96090 | r96091 >
Date:11:04, 2 September 2011
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -69,6 +69,7 @@
7070 $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
7171 $this->opts['target'] = $target;
7272 $this->opts['topOnly'] = $wgRequest->getBool( 'topOnly' );
 73+ $this->opts['showSizeDiff'] = $wgRequest->getBool( 'showSizeDiff' );
7374
7475 $nt = Title::makeTitleSafe( NS_USER, $target );
7576 if( !$nt ) {
@@ -126,6 +127,9 @@
127128 if ( $this->opts['topOnly'] ) {
128129 $apiParams['toponly'] = true;
129130 }
 131+ if ( $this->opts['showSizeDiff'] ) {
 132+ $apiParams['showsizediff'] = true;
 133+ }
130134 if ( $this->opts['deletedOnly'] ) {
131135 $apiParams['deletedonly'] = true;
132136 }
@@ -162,6 +166,7 @@
163167 'month' => $this->opts['month'],
164168 'deletedOnly' => $this->opts['deletedOnly'],
165169 'topOnly' => $this->opts['topOnly'],
 170+ 'showSizeDiff' => $this->opts['showSizeDiff'],
166171 ) );
167172 if( !$pager->getNumRows() ) {
168173 $wgOut->addWikiMsg( 'nocontribs', $target );
@@ -375,10 +380,14 @@
376381 $this->opts['topOnly'] = false;
377382 }
378383
 384+ if( !isset( $this->opts['showSizeDiff'] ) ) {
 385+ $this->opts['showSizeDiff'] = !$wgMiserMode;
 386+ }
 387+
379388 $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) );
380389
381390 # 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' );
383392 foreach ( $this->opts as $name => $value ) {
384393 if( in_array( $name, $skipParameters ) ) {
385394 continue;
@@ -389,10 +398,13 @@
390399 $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagFilter'] );
391400
392401 $fNS = '';
 402+ $fShowDiff = '';
393403 if ( !$wgMiserMode ) {
394404 $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'] );
397409 }
398410
399411 $f .= Xml::fieldset( wfMsg( 'sp-contributions-search' ) ) .
@@ -409,6 +421,7 @@
410422 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) . '<br />' .
411423 Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'sp-contributions-toponly' ),
412424 'topOnly', 'mw-show-top-only', $this->opts['topOnly'] ) ) .
 425+ $fShowDiff.
413426 ( $tagFilter ? Xml::tags( 'p', null, implode( '&#160;', $tagFilter ) ) : '' ) .
414427 Html::rawElement( 'p', array( 'style' => 'white-space: nowrap' ),
415428 Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) . ' ' .
@@ -449,6 +462,7 @@
450463
451464 $this->deletedOnly = !empty( $options['deletedOnly'] );
452465 $this->topOnly = !empty( $options['topOnly'] );
 466+ $this->showSizeDiff = !empty( $options['showSizeDiff'] );
453467
454468 $year = isset( $options['year'] ) ? $options['year'] : false;
455469 $month = isset( $options['month'] ) ? $options['month'] : false;
@@ -468,7 +482,7 @@
469483 }
470484
471485 function getQueryInfo() {
472 - global $wgUser;
 486+ global $wgUser, $wgMiserMode;
473487 list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
474488
475489 $conds = array_merge( $userCond, $this->getNamespaceCond() );
@@ -481,14 +495,21 @@
482496 }
483497 $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
484498
 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+
485511 $queryInfo = array(
486512 '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,
493514 'conds' => $conds,
494515 'options' => array( 'USE INDEX' => array('revision' => $index) ),
495516 'join_conds' => $join_cond
@@ -511,7 +532,7 @@
512533 $join_conds = array();
513534
514535 if( $this->target == 'newbies' ) {
515 - $tables = array( 'recentchanges', 'user_groups', 'page', 'revision' );
 536+ $tables = array( 'user_groups', 'page', 'revision' );
516537 $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
517538 $condition[] = 'rev_user >' . (int)($max - $max / 100);
518539 $condition[] = 'ug_group IS NULL';
@@ -520,7 +541,7 @@
521542 $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" );
522543 $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid AND rev_timestamp = rc_timestamp" );
523544 } else {
524 - $tables = array( 'recentchanges', 'page', 'revision' );
 545+ $tables = array( 'page', 'revision' );
525546 $condition['rev_user_text'] = $this->target;
526547 $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid AND rev_timestamp = rc_timestamp" );
527548 $index = 'usertext_timestamp';
@@ -669,9 +690,10 @@
670691
671692 $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')';
672693
673 - $diffOut = ' . . ' . $wgLang->getDirMark() .
674 - ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len );
675694
 695+ $diffOut = ' . . ' . $wgLang->getDirMark() . ( $this->showSizeDiff ?
 696+ ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ) : Linker::formatRevisionSize( $row->rev_len ) );
 697+
676698 $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}";
677699
678700 # Denote if username is redacted for this edit
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3006,6 +3006,7 @@
30073007 'sp-contributions-explain' => '', # only translate this message to other languages if you have to change it
30083008 'sp-contributions-footer' => '-', # do not translate or duplicate this message to other languages
30093009 'sp-contributions-footer-anon' => '-', # do not translate or duplicate this message to other languages
 3010+'sp-contributions-showsizediff' => 'Display difference in page size',
30103011
30113012 # What links here
30123013 'whatlinkshere' => 'What links here',
Index: trunk/phase3/maintenance/language/messages.inc
@@ -2032,6 +2032,7 @@
20332033 'sp-contributions-explain',
20342034 'sp-contributions-footer',
20352035 'sp-contributions-footer-anon',
 2036+ 'sp-contributions-showsizediff',
20362037 ),
20372038 'whatlinkshere' => array(
20382039 'whatlinkshere',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95496Revert r8811...reedy17:35, 25 August 2011
r95506fu r95496: remove the messages reallyraymond19:44, 25 August 2011
r95524Fux PHP Notice: Undefined property: ContribsPager::$showSizeDiff in /www/w/in...reedy21:22, 25 August 2011
r95553Fix another remnant of r95496reedy11:15, 26 August 2011
r96005Followup r95496, remove duplicate $fields definitionreedy16:01, 1 September 2011

Status & tagging log