Revert r95496, r95506, r95524, r95553, r96005
authorSam Reed <reedy@users.mediawiki.org>
Fri, 2 Sep 2011 11:04:57 +0000 (11:04 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Fri, 2 Sep 2011 11:04:57 +0000 (11:04 +0000)
includes/specials/SpecialContributions.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 1d0eed7..7703468 100644 (file)
@@ -69,6 +69,7 @@ class SpecialContributions extends SpecialPage {
                $this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
                $this->opts['target'] = $target;
                $this->opts['topOnly'] = $wgRequest->getBool( 'topOnly' );
+               $this->opts['showSizeDiff'] = $wgRequest->getBool( 'showSizeDiff' );
 
                $nt = Title::makeTitleSafe( NS_USER, $target );
                if( !$nt ) {
@@ -126,6 +127,9 @@ class SpecialContributions extends SpecialPage {
                        if ( $this->opts['topOnly'] ) {
                                $apiParams['toponly'] = true;
                        }
+                       if ( $this->opts['showSizeDiff'] ) {
+                               $apiParams['showsizediff'] = true;
+                       }
                        if ( $this->opts['deletedOnly'] ) {
                                $apiParams['deletedonly'] = true;
                        }
@@ -162,6 +166,7 @@ class SpecialContributions extends SpecialPage {
                                'month' => $this->opts['month'],
                                'deletedOnly' => $this->opts['deletedOnly'],
                                'topOnly' => $this->opts['topOnly'],
+                               'showSizeDiff' => $this->opts['showSizeDiff'],
                        ) );
                        if( !$pager->getNumRows() ) {
                                $wgOut->addWikiMsg( 'nocontribs', $target );
@@ -375,10 +380,14 @@ class SpecialContributions extends SpecialPage {
                        $this->opts['topOnly'] = false;
                }
 
+               if( !isset( $this->opts['showSizeDiff'] ) ) {
+                       $this->opts['showSizeDiff'] = !$wgMiserMode;
+               }
+
                $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) );
 
                # Add hidden params for tracking except for parameters in $skipParameters
-               $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly' );
+               $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'showSizeDiff' );
                foreach ( $this->opts as $name => $value ) {
                        if( in_array( $name, $skipParameters ) ) {
                                continue;
@@ -389,10 +398,13 @@ class SpecialContributions extends SpecialPage {
                $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagFilter'] );
 
                $fNS = '';
+               $fShowDiff = '';
                if ( !$wgMiserMode ) {
                        $fNS = Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
-                               Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' . Xml::namespaceSelector( $this->opts['namespace'], '' )
-                       );
+                                       Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' .
+                                       Xml::namespaceSelector( $this->opts['namespace'], '' )
+                               );
+                       $fShowDiff = Xml::checkLabel( wfMsg( 'sp-contributions-showsizediff' ), 'showSizeDiff', 'mw-show-size-diff', $this->opts['showSizeDiff'] );
                }
 
                $f .=   Xml::fieldset( wfMsg( 'sp-contributions-search' ) ) .
@@ -409,6 +421,7 @@ class SpecialContributions extends SpecialPage {
                                'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) . '<br />' .
                        Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'sp-contributions-toponly' ),
                                'topOnly', 'mw-show-top-only', $this->opts['topOnly'] ) ) .
+                       $fShowDiff.
                        ( $tagFilter ? Xml::tags( 'p', null, implode( '&#160;', $tagFilter ) ) : '' ) .
                        Html::rawElement( 'p', array( 'style' => 'white-space: nowrap' ),
                                Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) . ' ' .
@@ -449,6 +462,7 @@ class ContribsPager extends ReverseChronologicalPager {
 
                $this->deletedOnly = !empty( $options['deletedOnly'] );
                $this->topOnly = !empty( $options['topOnly'] );
+               $this->showSizeDiff = !empty( $options['showSizeDiff'] );
 
                $year = isset( $options['year'] ) ? $options['year'] : false;
                $month = isset( $options['month'] ) ? $options['month'] : false;
@@ -468,7 +482,7 @@ class ContribsPager extends ReverseChronologicalPager {
        }
 
        function getQueryInfo() {
-               global $wgUser;
+               global $wgUser, $wgMiserMode;
                list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
 
                $conds = array_merge( $userCond, $this->getNamespaceCond() );
@@ -481,14 +495,21 @@ class ContribsPager extends ReverseChronologicalPager {
                }
                $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
 
+               $fields = array(
+                       'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect',
+                       'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
+                       'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted',
+                       'rev_len'
+               );
+               if ( $this->showSizeDiff && !$wgMiserMode ) {
+                       $fields = array_merge( $fields,  array( 'rc_old_len', 'rc_new_len' ) );
+                       array_unshift( $tables, 'recentchanges' );
+                       $join_cond['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid" );
+               }
+
                $queryInfo = array(
                        'tables' => $tables,
-                       'fields' => array(
-                               'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect',
-                               'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
-                               'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted',
-                               'rc_old_len', 'rc_new_len'
-                       ),
+                       'fields' => $fields,
                        'conds' => $conds,
                        'options' => array( 'USE INDEX' => array('revision' => $index) ),
                        'join_conds' => $join_cond
@@ -511,7 +532,7 @@ class ContribsPager extends ReverseChronologicalPager {
                $join_conds = array();
 
                if( $this->target == 'newbies' ) {
-                       $tables = array( 'recentchanges', 'user_groups', 'page', 'revision' );
+                       $tables = array( 'user_groups', 'page', 'revision' );
                        $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
                        $condition[] = 'rev_user >' . (int)($max - $max / 100);
                        $condition[] = 'ug_group IS NULL';
@@ -520,7 +541,7 @@ class ContribsPager extends ReverseChronologicalPager {
                        $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" );
                        $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid AND rev_timestamp = rc_timestamp" );
                } else {
-                       $tables = array( 'recentchanges', 'page', 'revision' );
+                       $tables = array( 'page', 'revision' );
                        $condition['rev_user_text'] = $this->target;
                        $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid AND rev_timestamp = rc_timestamp" );
                        $index = 'usertext_timestamp';
@@ -669,8 +690,9 @@ class ContribsPager extends ReverseChronologicalPager {
 
                $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')';
 
-               $diffOut = ' . . ' . $wgLang->getDirMark() .
-                       ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len );
+
+               $diffOut = ' . . ' . $wgLang->getDirMark() . ( $this->showSizeDiff ?
+                       ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ) : Linker::formatRevisionSize( $row->rev_len ) );
 
                $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}";
 
index 98b3712..8da69ec 100644 (file)
@@ -3006,6 +3006,7 @@ The latest block log entry is provided below for reference:',
 'sp-contributions-explain'             => '', # only translate this message to other languages if you have to change it
 'sp-contributions-footer'              => '-', # do not translate or duplicate this message to other languages
 'sp-contributions-footer-anon'         => '-', # do not translate or duplicate this message to other languages
+'sp-contributions-showsizediff'        => 'Display difference in page size',
 
 # What links here
 'whatlinkshere'            => 'What links here',
index 9caf7e5..755cfc1 100644 (file)
@@ -2032,6 +2032,7 @@ $wgMessageStructure = array(
                'sp-contributions-explain',
                'sp-contributions-footer',
                'sp-contributions-footer-anon',
+               'sp-contributions-showsizediff',
        ),
        'whatlinkshere' => array(
                'whatlinkshere',