r92550 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92549‎ | r92550 | r92551 >
Date:18:51, 19 July 2011
Author:aaron
Status:ok
Tags:
Comment:
MFT r92422
Modified paths:
  • /branches/wmf/1.17wmf1/maintenance/Maintenance.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/maintenance/Maintenance.php
@@ -565,10 +565,14 @@
566566 } elseif ( substr( $arg, 0, 2 ) == '--' ) {
567567 # Long options
568568 $option = substr( $arg, 2 );
 569+ if ( array_key_exists( $option, $options ) ) {
 570+ $this->error( "\nERROR: $option parameter given twice\n" );
 571+ $this->maybeHelp( true );
 572+ }
569573 if ( isset( $this->mParams[$option] ) && $this->mParams[$option]['withArg'] ) {
570574 $param = next( $argv );
571575 if ( $param === false ) {
572 - $this->error( "\nERROR: $option needs a value after it\n" );
 576+ $this->error( "\nERROR: $option parameter needs a value after it\n" );
573577 $this->maybeHelp( true );
574578 }
575579 $options[$option] = $param;
@@ -586,10 +590,14 @@
587591 # Short options
588592 for ( $p = 1; $p < strlen( $arg ); $p++ ) {
589593 $option = $arg { $p } ;
 594+ if ( array_key_exists( $option, $options ) ) {
 595+ $this->error( "\nERROR: $option parameter given twice\n" );
 596+ $this->maybeHelp( true );
 597+ }
590598 if ( isset( $this->mParams[$option]['withArg'] ) && $this->mParams[$option]['withArg'] ) {
591599 $param = next( $argv );
592600 if ( $param === false ) {
593 - $this->error( "\nERROR: $option needs a value after it\n" );
 601+ $this->error( "\nERROR: $option parameter needs a value after it\n" );
594602 $this->maybeHelp( true );
595603 }
596604 $options[$option] = $param;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92422Disallow given options twice (instead of letting the newest one take preceden...aaron03:30, 18 July 2011

Status & tagging log