r96306 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96305‎ | r96306 | r96307 >
Date:21:47, 5 September 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
Revert r88008 (add size difference to Special:Contributions) and its large group of friends, they break Special:Contributions by joining against recentchanges and dropping any contribs that have fallen off RC. See also CR discussion at r95496, which was Sam's incomplete attempt at reverting this.

Follow-ups reverted: r88019, r88024, r88111, r88117, r88252, r96081. Left the parts of r88025 and r88026 (everything except the MessagesEn.php change) that disable the namespace filter in miser mode intact; that was a good change and not really related to the r88008 other than that it touched nearby code.
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/maintenance/language/messages.inc
@@ -2032,7 +2032,6 @@
20332033 'sp-contributions-explain',
20342034 'sp-contributions-footer',
20352035 'sp-contributions-footer-anon',
2036 - 'sp-contributions-showsizediff',
20372036 ),
20382037 'whatlinkshere' => array(
20392038 'whatlinkshere',
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -69,7 +69,6 @@
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' );
7473
7574 $nt = Title::makeTitleSafe( NS_USER, $target );
7675 if( !$nt ) {
@@ -166,7 +165,6 @@
167166 'month' => $this->opts['month'],
168167 'deletedOnly' => $this->opts['deletedOnly'],
169168 'topOnly' => $this->opts['topOnly'],
170 - 'showSizeDiff' => $this->opts['showSizeDiff'],
171169 ) );
172170 if( !$pager->getNumRows() ) {
173171 $wgOut->addWikiMsg( 'nocontribs', $target );
@@ -380,14 +378,10 @@
381379 $this->opts['topOnly'] = false;
382380 }
383381
384 - if( !isset( $this->opts['showSizeDiff'] ) ) {
385 - $this->opts['showSizeDiff'] = !$wgMiserMode;
386 - }
387 -
388382 $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) );
389383
390384 # Add hidden params for tracking except for parameters in $skipParameters
391 - $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'showSizeDiff' );
 385+ $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly' );
392386 foreach ( $this->opts as $name => $value ) {
393387 if( in_array( $name, $skipParameters ) ) {
394388 continue;
@@ -397,15 +391,11 @@
398392
399393 $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagFilter'] );
400394
401 - $fNS = '';
402 - $fShowDiff = '';
403 - if ( !$wgMiserMode ) {
404 - $fNS = Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
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'] );
409 - }
 395+ $fNS = ( $wgMiserMode ) ? '' :
 396+ Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
 397+ Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' .
 398+ Xml::namespaceSelector( $this->opts['namespace'], '' )
 399+ );
410400
411401 $f .= Xml::fieldset( wfMsg( 'sp-contributions-search' ) ) .
412402 Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parsemag' ) ),
@@ -421,7 +411,6 @@
422412 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) . '<br />' .
423413 Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'sp-contributions-toponly' ),
424414 'topOnly', 'mw-show-top-only', $this->opts['topOnly'] ) ) .
425 - $fShowDiff.
426415 ( $tagFilter ? Xml::tags( 'p', null, implode( '&#160;', $tagFilter ) ) : '' ) .
427416 Html::rawElement( 'p', array( 'style' => 'white-space: nowrap' ),
428417 Xml::dateMenu( $this->opts['year'], $this->opts['month'] ) . ' ' .
@@ -462,7 +451,6 @@
463452
464453 $this->deletedOnly = !empty( $options['deletedOnly'] );
465454 $this->topOnly = !empty( $options['topOnly'] );
466 - $this->showSizeDiff = !empty( $options['showSizeDiff'] );
467455
468456 $year = isset( $options['year'] ) ? $options['year'] : false;
469457 $month = isset( $options['month'] ) ? $options['month'] : false;
@@ -482,7 +470,7 @@
483471 }
484472
485473 function getQueryInfo() {
486 - global $wgUser, $wgMiserMode;
 474+ global $wgUser;
487475 list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
488476
489477 $conds = array_merge( $userCond, $this->getNamespaceCond() );
@@ -495,25 +483,18 @@
496484 }
497485 $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
498486
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 -
511487 $queryInfo = array(
512488 'tables' => $tables,
513 - 'fields' => $fields,
 489+ 'fields' => array(
 490+ 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect',
 491+ 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
 492+ 'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted'
 493+ ),
514494 'conds' => $conds,
515495 'options' => array( 'USE INDEX' => array('revision' => $index) ),
516496 'join_conds' => $join_cond
517497 );
 498+
518499 ChangeTags::modifyDisplayQuery(
519500 $queryInfo['tables'],
520501 $queryInfo['fields'],
@@ -527,10 +508,9 @@
528509 return $queryInfo;
529510 }
530511
531 - function getUserCond() {
 512+ function getUserCond() {
532513 $condition = array();
533514 $join_conds = array();
534 -
535515 if( $this->target == 'newbies' ) {
536516 $tables = array( 'user_groups', 'page', 'revision' );
537517 $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
@@ -539,11 +519,9 @@
540520 $index = 'user_timestamp';
541521 # @todo FIXME: Other groups may have 'bot' rights
542522 $join_conds['user_groups'] = array( 'LEFT JOIN', "ug_user = rev_user AND ug_group = 'bot'" );
543 - $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid AND rev_timestamp = rc_timestamp" );
544523 } else {
545524 $tables = array( 'page', 'revision' );
546525 $condition['rev_user_text'] = $this->target;
547 - $join_conds['recentchanges'] = array( 'INNER JOIN', "rev_id = rc_this_oldid AND rev_timestamp = rc_timestamp" );
548526 $index = 'usertext_timestamp';
549527 }
550528 if( $this->deletedOnly ) {
@@ -689,13 +667,8 @@
690668 }
691669
692670 $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')';
 671+ $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
693672
694 -
695 - $diffOut = ' . . ' . $wgLang->getDirMark() . ( $this->showSizeDiff ?
696 - ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ) : Linker::formatRevisionSize( $row->rev_len ) );
697 -
698 - $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}";
699 -
700673 # Denote if username is redacted for this edit
701674 if( $rev->isDeleted( Revision::DELETED_USER ) ) {
702675 $ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3006,7 +3006,6 @@
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',
30113010
30123011 # What links here
30133012 'whatlinkshere' => 'What links here',

Sign-offs

UserFlagDate
😂inspected04:22, 6 September 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r96342Fix Undefined index: showSizeDiff in /www/w/includes/specials/SpecialContribu...reedy15:23, 6 September 2011
r965111.18: MFT r96163, r96174, r96212, r96217, r96218, r96271, r96273, r96306, r96...catrope22:07, 7 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88008* bug 24037freakolowsky17:11, 13 May 2011
r88019* fixed as per comment on r88008freakolowsky21:33, 13 May 2011
r88024* partial revert of r88019. Left the messages in for now ... don't know ... t...freakolowsky23:18, 13 May 2011
r88025* removed unused messages because of previous revert....freakolowsky23:31, 13 May 2011
r88026* addon to previousfreakolowsky23:42, 13 May 2011
r88111* added an option to toggle the display of diff size with a warning message....freakolowsky17:05, 14 May 2011
r88117* added alternative revison size display if diff size is not selectedfreakolowsky22:06, 14 May 2011
r88252Remove verboseness (image and infobox) in Special:Contributions for diff size...siebrand17:51, 16 May 2011
r95496Revert r8811...reedy17:35, 25 August 2011
r96081* added redundand join condition for index usage as per comment on CR r88008freakolowsky06:58, 2 September 2011

Comments

#Comment by Platonides (talk | contribs)   21:17, 8 September 2011

Wouldn't changing the INNER JOIN to LEFT JOIN have solved it?

That is, if someone is brave enough to retry this.

#Comment by Catrope (talk | contribs)   09:49, 9 September 2011

Anyone that wants to try that, go for it. But if broken code is committed and the no one (not even the committer) shows any interest in fixing it quickly, it's reverted. I think we re-established that principle quite clearly on the mailing list a few months back.

#Comment by Platonides (talk | contribs)   22:06, 10 September 2011

Heh, no problem with that. In fact, it may be preferable to start it again, given its convoluted history (from reading r95496). They mention the LEFT JOIN but wasn't done. It striked me, as the description "joining against recentchanges and dropping any contribs that have fallen off RC" points clearly to an INNER JOIN that should have been LEFT. Good that more work on this is welcome, but I'm not able to dedicate it time right now.

#Comment by Catrope (talk | contribs)   11:22, 12 September 2011

Yeah, same here. It would be cleaner to just re-do it right in one revision (or at least fewer than before, so the history isn't so crazy), but I don't have time to do this either.

Status & tagging log