From: scribu Date: Sat, 23 Nov 2013 09:39:26 +0000 (+0200) Subject: make merge_config() work for runtime args too X-Git-Tag: v0.13.0~23 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=db15b9c44bc2c8f6cb0f0af196e9105969c7f8dc;p=wvm%2Fwvm.git make merge_config() work for runtime args too --- diff --git a/php/WP_CLI/Configurator.php b/php/WP_CLI/Configurator.php index 791c6c5a..2bfeacf2 100644 --- a/php/WP_CLI/Configurator.php +++ b/php/WP_CLI/Configurator.php @@ -84,9 +84,9 @@ class Configurator { return array( $regular_args, $assoc_args, $runtime_config ); } - function merge_config( $config ) { + function merge_config( $config, $type ) { foreach ( $this->spec as $key => $details ) { - if ( $details['file'] && isset( $config[ $key ] ) ) { + if ( false !== $details[ $type ] && isset( $config[ $key ] ) ) { $value = $config[ $key ]; if ( $details['multiple'] ) { diff --git a/php/WP_CLI/Runner.php b/php/WP_CLI/Runner.php index a107a285..707b371f 100644 --- a/php/WP_CLI/Runner.php +++ b/php/WP_CLI/Runner.php @@ -368,15 +368,11 @@ class Runner { $configurator = \WP_CLI::get_configurator(); foreach ( array( $this->global_config_path, $this->project_config_path ) as $config_path ) { - $configurator->merge_config( self::load_config( $config_path ) ); + $configurator->merge_config( self::load_config( $config_path ), 'file' ); } - $configurator->merge_config( $runtime_config ); + $configurator->merge_config( $runtime_config, 'runtime' ); $this->config = $configurator->to_array(); - // --prompt can't be set in file, but is still a valid runtime arg - if ( ! empty( $runtime_config['prompt'] ) ) - $this->config['prompt'] = true; - if ( !isset( $this->config['path'] ) ) { $this->config['path'] = dirname( Utils\find_file_upward( 'wp-load.php' ) ); }