r68317 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68316‎ | r68317 | r68318 >
Date:14:48, 20 June 2010
Author:mgrabovsky
Status:ok
Tags:
Comment:
Follow-up r68307: ContribsPager now accepts array of options as one parameter insted of one parameter for each option
Modified paths:
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -67,7 +67,7 @@
6868 $this->opts['namespace'] = '';
6969 }
7070
71 - $this->opts['tagfilter'] = (string) $wgRequest->getVal( 'tagfilter' );
 71+ $this->opts['tagFilter'] = (string) $wgRequest->getVal( 'tagFilter' );
7272
7373 // Allows reverts to have the bot flag in recent changes. It is just here to
7474 // be passed in the form at the top of the page
@@ -96,8 +96,14 @@
9797
9898 $wgOut->addHTML( $this->getForm() );
9999
100 - $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'],
101 - $this->opts['month'], false, $this->opts['deletedOnly'], $this->opts['topOnly'] );
 100+ $pager = new ContribsPager( array(
 101+ 'target' => $target,
 102+ 'namespace' => $this->opts['namespace'],
 103+ 'year' => $this->opts['year'],
 104+ 'month' => $this->opts['month'],
 105+ 'deletedOnly' => $this->opts['deletedOnly'],
 106+ 'topOnly' => $this->opts['topOnly'],
 107+ ) );
102108 if( !$pager->getNumRows() ) {
103109 $wgOut->addWikiMsg( 'nocontribs', $target );
104110 } else {
@@ -295,8 +301,8 @@
296302 $this->opts['target'] = '';
297303 }
298304
299 - if( !isset( $this->opts['tagfilter'] ) ) {
300 - $this->opts['tagfilter'] = '';
 305+ if( !isset( $this->opts['tagFilter'] ) ) {
 306+ $this->opts['tagFilter'] = '';
301307 }
302308
303309 if( !isset( $this->opts['topOnly'] ) ) {
@@ -314,7 +320,7 @@
315321 $f .= "\t" . Xml::hidden( $name, $value ) . "\n";
316322 }
317323
318 - $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
 324+ $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagFilter'] );
319325
320326 $f .= '<fieldset>' .
321327 Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
@@ -380,8 +386,15 @@
381387 $nt = Title::makeTitleSafe( NS_USER, $this->opts['target'] );
382388 $target = $this->opts['target'] == 'newbies' ? 'newbies' : $nt->getText();
383389
384 - $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'],
385 - $this->opts['month'], $this->opts['tagfilter'], $this->opts['deletedOnly'], $this->opts['topOnly'] );
 390+ $pager = new ContribsPager( array(
 391+ 'target' => $target,
 392+ 'namespace' => $this->opts['namespace'],
 393+ 'year' => $this->opts['year'],
 394+ 'month' => $this->opts['month'],
 395+ 'tagFilter' => $this->opts['tagFilter'],
 396+ 'deletedOnly' => $this->opts['deletedOnly'],
 397+ 'topOnly' => $this->opts['topOnly'],
 398+ ) );
386399
387400 $pager->mLimit = min( $this->opts['limit'], $wgFeedLimit );
388401
@@ -445,7 +458,7 @@
446459 var $messages, $target;
447460 var $namespace = '', $mDb;
448461
449 - function __construct( $target, $namespace = false, $year = false, $month = false, $tagFilter = false, $deletedOnly = false, $topOnly = false ) {
 462+ function __construct( $options ) {
450463 parent::__construct();
451464
452465 $msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
@@ -454,12 +467,15 @@
455468 $this->messages[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
456469 }
457470
458 - $this->target = $target;
459 - $this->namespace = $namespace;
460 - $this->tagFilter = $tagFilter;
461 - $this->deletedOnly = $deletedOnly;
462 - $this->topOnly = $topOnly;
 471+ $this->target = isset( $options['target'] ) ? $options['target'] : '';
 472+ $this->namespace = isset( $options['namespace'] ) ? $options['namespace'] : '';
 473+ $this->tagFilter = isset( $options['tagFilter'] ) ? $options['tagFilter'] : false;
463474
 475+ $this->deletedOnly = !empty( $options['deletedOnly'] );
 476+ $this->topOnly = !empty( $options['topOnly'] );
 477+
 478+ $year = isset( $options['year'] ) ? $options['year'] : false;
 479+ $month = isset( $options['month'] ) ? $options['month'] : false;
464480 $this->getDateCond( $year, $month );
465481
466482 $this->mDb = wfGetDB( DB_SLAVE, 'contributions' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68307(bug 4597) Provide support in Special:Contributions to show only "current" co...mgrabovsky11:37, 20 June 2010

Status & tagging log