X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcommandLine.inc;h=bb1443f6ebec2b531fc14e12fde3ca03be756a63;hb=98f987241a798788817e87e2c4bec4c03ccdd8a5;hp=33299588fda09f958d6a8b2a404f85eae0dd1f07;hpb=ba00b23a1d6fea3f05c617d3df73d60ab28dfdf4;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;