X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=maintenance%2FcommandLine.inc;h=bb1443f6ebec2b531fc14e12fde3ca03be756a63;hb=1791c928939f906627b9fb86c57ff8d9d626cbdb;hp=86a558d0e1068b987aff07636f1b43d888f74e31;hpb=ba25ed9ee004985826eeb4635ebf740da95ef297;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index 86a558d0e1..bb1443f6eb 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -21,24 +21,41 @@ * @ingroup Maintenance */ -require_once( __DIR__ . '/Maintenance.php' ); +require_once __DIR__ . '/Maintenance.php'; + +// phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix +global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions; -global $optionsWithArgs; if ( !isset( $optionsWithArgs ) ) { - $optionsWithArgs = array(); + $optionsWithArgs = []; +} +if ( !isset( $optionsWithoutArgs ) ) { + $optionsWithoutArgs = []; +} +if ( !isset( $allowUnregisteredOptions ) ) { + $allowUnregisteredOptions = false; } class CommandLineInc extends Maintenance { public function __construct() { - global $optionsWithArgs; + // 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 ); } /** * No help, it would just be misleading since it misses custom options + * @param bool $force */ protected function maybeHelp( $force = false ) { if ( !$force ) { @@ -48,12 +65,13 @@ class CommandLineInc extends Maintenance { } public function execute() { + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $args, $options; + $args = $this->mArgs; $options = $this->mOptions; } } -$maintClass = 'CommandLineInc'; -require( RUN_MAINTENANCE_IF_MAIN ); - +$maintClass = CommandLineInc::class; +require RUN_MAINTENANCE_IF_MAIN;