r92422 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92421‎ | r92422 | r92423 >
Date:03:30, 18 July 2011
Author:aaron
Status:ok
Tags:
Comment:
Disallow given options twice (instead of letting the newest one take precedence). This property may be useful for a Het Deploy wrapper.
Modified paths:
  • /trunk/phase3/maintenance/Maintenance.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/Maintenance.php
@@ -597,10 +597,14 @@
598598 } elseif ( substr( $arg, 0, 2 ) == '--' ) {
599599 # Long options
600600 $option = substr( $arg, 2 );
 601+ if ( array_key_exists( $option, $options ) ) {
 602+ $this->error( "\nERROR: $option parameter given twice\n" );
 603+ $this->maybeHelp( true );
 604+ }
601605 if ( isset( $this->mParams[$option] ) && $this->mParams[$option]['withArg'] ) {
602606 $param = next( $argv );
603607 if ( $param === false ) {
604 - $this->error( "\nERROR: $option needs a value after it\n" );
 608+ $this->error( "\nERROR: $option parameter needs a value after it\n" );
605609 $this->maybeHelp( true );
606610 }
607611 $options[$option] = $param;
@@ -621,10 +625,14 @@
622626 if ( !isset( $this->mParams[$option] ) && isset( $this->mShortParamsMap[$option] ) ) {
623627 $option = $this->mShortParamsMap[$option];
624628 }
 629+ if ( array_key_exists( $option, $options ) ) {
 630+ $this->error( "\nERROR: $option parameter given twice\n" );
 631+ $this->maybeHelp( true );
 632+ }
625633 if ( isset( $this->mParams[$option]['withArg'] ) && $this->mParams[$option]['withArg'] ) {
626634 $param = next( $argv );
627635 if ( $param === false ) {
628 - $this->error( "\nERROR: $option needs a value after it\n" );
 636+ $this->error( "\nERROR: $option parameter needs a value after it\n" );
629637 $this->maybeHelp( true );
630638 }
631639 $options[$option] = $param;

Follow-up revisions

RevisionCommit summaryAuthorDate
r92550MFT r92422aaron18:51, 19 July 2011
r96559MFT r92422, r93520, r93563, r94107, r94433, r95042, r95332, r95451, r96386...reedy12:49, 8 September 2011

Status & tagging log