X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=maintenance%2FcommandLine.inc;h=bb1443f6ebec2b531fc14e12fde3ca03be756a63;hb=0098688a002524b2250451bb231cdad2a4bd54d1;hp=88776f4f41b480943288523c90048acde038c2bf;hpb=6b1a173f07f1a04188735f4688ce6335da14c3b7;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index 88776f4f41..bb1443f6eb 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -23,22 +23,34 @@ require_once __DIR__ . '/Maintenance.php'; -// @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix -global $optionsWithArgs; -// @codingStandardsIgnoreEnd +// phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix +global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions; + if ( !isset( $optionsWithArgs ) ) { - $optionsWithArgs = array(); + $optionsWithArgs = []; +} +if ( !isset( $optionsWithoutArgs ) ) { + $optionsWithoutArgs = []; +} +if ( !isset( $allowUnregisteredOptions ) ) { + $allowUnregisteredOptions = false; } class CommandLineInc extends Maintenance { public function __construct() { - // @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix - global $optionsWithArgs; - // @codingStandardsIgnoreEnd + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix + 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 ); } /** @@ -53,14 +65,13 @@ class CommandLineInc extends Maintenance { } public function execute() { - // @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $args, $options; - // @codingStandardsIgnoreEnd + $args = $this->mArgs; $options = $this->mOptions; } } -$maintClass = 'CommandLineInc'; +$maintClass = CommandLineInc::class; require RUN_MAINTENANCE_IF_MAIN; -