From 9ec06baeb39aef13376baa7e7e5af8b61071a3d2 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Mon, 15 Apr 2019 09:25:14 -0300 Subject: [PATCH] ensure the /dist/ folder exists before writing feature-config-core - change the default target environment to development --- plugins/woocommerce-admin/bin/generate-feature-config.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-admin/bin/generate-feature-config.php b/plugins/woocommerce-admin/bin/generate-feature-config.php index 383e075c427..eba4c85c5d6 100644 --- a/plugins/woocommerce-admin/bin/generate-feature-config.php +++ b/plugins/woocommerce-admin/bin/generate-feature-config.php @@ -7,7 +7,7 @@ $phase = isset( $_SERVER['WC_ADMIN_PHASE'] ) ? $_SERVER['WC_ADMIN_PHASE'] : ''; // WPCS: sanitization ok. if ( ! in_array( $phase, array( 'development', 'plugin', 'core' ), true ) ) { - $phase = 'core'; + $phase = 'development'; } $config_json = file_get_contents( 'config/' . $phase . '.json' ); $config = json_decode( $config_json ); @@ -35,6 +35,10 @@ if ( 'core' !== $phase ) { } $write .= "\t\t\t)"; + if ( is_file( './dist' ) || ! wp_mkdir_p( './dist' ) ) { + exit( 1 ); + } + $config_file = fopen( 'dist/feature-config-core.php', 'w' ); }