X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcommandLine.inc;h=bb1443f6ebec2b531fc14e12fde3ca03be756a63;hb=69892e932e012ab3a80e90072a33c26ef7e6e052;hp=1a05907979f2afa99357073711ded47935a53e2a;hpb=052770c40b84e22ddd42ff5686e0aaf3b9131030;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index 1a05907979..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,13 +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;