X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FgetConfiguration.php;h=65ffe1422b77eeb46ee9b6498cba0cc8f00e6d5d;hb=44dc960da179f0bdff3716cf88acdf397c1b9cfb;hp=b1140ecbd6f0b7319fc749f7abe17deb08213543;hpb=7ed96f4de2411d21cce4572e1fac7d3a8d2d0b77;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/getConfiguration.php b/maintenance/getConfiguration.php index b1140ecbd6..65ffe1422b 100644 --- a/maintenance/getConfiguration.php +++ b/maintenance/getConfiguration.php @@ -34,18 +34,18 @@ class GetConfiguration extends Maintenance { protected $regex = null; - protected $settings_list = array(); + protected $settings_list = []; /** * List of format output internally supported. * Each item MUST be lower case. */ - protected static $outFormats = array( + protected static $outFormats = [ 'json', 'php', 'serialize', 'vardump', - ); + ]; public function __construct() { parent::__construct(); @@ -53,7 +53,7 @@ class GetConfiguration extends Maintenance { $this->addOption( 'regex', 'regex to filter variables with', false, true ); $this->addOption( 'iregex', 'same as --regex but case insensitive', false, true ); $this->addOption( 'settings', 'Space-separated list of wg* variables', false, true ); - $this->addOption( 'format', join( ', ', self::$outFormats ), false, true ); + $this->addOption( 'format', implode( ', ', self::$outFormats ), false, true ); } protected function validateParamsAndArgs() { @@ -101,7 +101,7 @@ class GetConfiguration extends Maintenance { foreach ( $this->settings_list as $name ) { if ( !preg_match( '/^wg[A-Z]/', $name ) ) { throw new MWException( "Variable '$name' does start with 'wg'." ); - } elseif ( !isset( $GLOBALS[$name] ) ) { + } elseif ( !array_key_exists( $name, $GLOBALS ) ) { throw new MWException( "Variable '$name' is not set." ); } elseif ( !$this->isAllowedVariable( $GLOBALS[$name] ) ) { throw new MWException( "Variable '$name' includes non-array, non-scalar, items." ); @@ -112,7 +112,7 @@ class GetConfiguration extends Maintenance { public function execute() { // Settings we will display - $res = array(); + $res = []; # Sane default: dump any wg / wmg variable if ( !$this->regex && !$this->getOption( 'settings' ) ) { @@ -121,7 +121,7 @@ class GetConfiguration extends Maintenance { # Filter out globals based on the regex if ( $this->regex ) { - $res = array(); + $res = []; foreach ( $GLOBALS as $name => $value ) { if ( preg_match( $this->regex, $name ) ) { $res[$name] = $value;