X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcommandLine.inc;h=bb1443f6ebec2b531fc14e12fde3ca03be756a63;hb=9dcdac86a52b28093aff046bc9c4c98363dafb61;hp=33299588fda09f958d6a8b2a404f85eae0dd1f07;hpb=fe4b09380562976aea9f06e59d342fff8d91b026;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index 33299588fd..bb1443f6eb 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -24,7 +24,7 @@ require_once __DIR__ . '/Maintenance.php'; // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix -global $optionsWithArgs, $optionsWithoutArgs; +global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions; if ( !isset( $optionsWithArgs ) ) { $optionsWithArgs = []; @@ -32,19 +32,25 @@ if ( !isset( $optionsWithArgs ) ) { if ( !isset( $optionsWithoutArgs ) ) { $optionsWithoutArgs = []; } +if ( !isset( $allowUnregisteredOptions ) ) { + $allowUnregisteredOptions = false; +} class CommandLineInc extends Maintenance { public function __construct() { // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix - global $optionsWithArgs, $optionsWithoutArgs; + global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions; parent::__construct(); + foreach ( $optionsWithArgs as $name ) { $this->addOption( $name, '', false, true ); } foreach ( $optionsWithoutArgs as $name ) { $this->addOption( $name, '', false, false ); } + + $this->setAllowUnregisteredOptions( $allowUnregisteredOptions ); } /** @@ -67,5 +73,5 @@ class CommandLineInc extends Maintenance { } } -$maintClass = 'CommandLineInc'; +$maintClass = CommandLineInc::class; require RUN_MAINTENANCE_IF_MAIN;