From b4fd0c3b7b6d928baf8282ac3b231b3c072dfc29 Mon Sep 17 00:00:00 2001 From: Christopher Allford <6451942+ObliviousHarmony@users.noreply.github.com> Date: Sat, 9 Dec 2023 21:33:34 -0800 Subject: [PATCH] Fixed Blocks INI File Path --- plugins/woocommerce-blocks/bin/webpack-configs.js | 2 +- plugins/woocommerce/.gitignore | 1 + .../src/Blocks/Domain/Services/FeatureGating.php | 12 ++++++------ plugins/woocommerce/woocommerce.php | 4 ++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/woocommerce-blocks/bin/webpack-configs.js b/plugins/woocommerce-blocks/bin/webpack-configs.js index fe5e2edef2f..444672dee96 100644 --- a/plugins/woocommerce-blocks/bin/webpack-configs.js +++ b/plugins/woocommerce-blocks/bin/webpack-configs.js @@ -117,7 +117,7 @@ const getCoreConfig = ( options = {} ) => { ...getSharedPlugins( { bundleAnalyzerReportTitle: 'Core' } ), new ProgressBarPlugin( getProgressBarPluginConfig( 'Core' ) ), new CreateFileWebpack( { - path: './', + path: '../woocommerce', // file name fileName: 'blocks.ini', // content of the file diff --git a/plugins/woocommerce/.gitignore b/plugins/woocommerce/.gitignore index d0e09157ebd..b97ec12355e 100644 --- a/plugins/woocommerce/.gitignore +++ b/plugins/woocommerce/.gitignore @@ -4,6 +4,7 @@ # Built JS /assets/js/* /assets/client/* +/blocks.ini # Behat/CLI Tests tests/cli/installer diff --git a/plugins/woocommerce/src/Blocks/Domain/Services/FeatureGating.php b/plugins/woocommerce/src/Blocks/Domain/Services/FeatureGating.php index 581e6aecd32..799ebee71e0 100644 --- a/plugins/woocommerce/src/Blocks/Domain/Services/FeatureGating.php +++ b/plugins/woocommerce/src/Blocks/Domain/Services/FeatureGating.php @@ -49,9 +49,9 @@ class FeatureGating { public function load_flag() { if ( 0 === $this->flag ) { $default_flag = defined( 'WC_BLOCKS_IS_FEATURE_PLUGIN' ) ? self::FEATURE_PLUGIN_FLAG : self::CORE_FLAG; - if ( file_exists( __DIR__ . '/../../../blocks.ini' ) ) { + if ( file_exists( __DIR__ . '/../../../../blocks.ini' ) ) { $allowed_flags = [ self::EXPERIMENTAL_FLAG, self::FEATURE_PLUGIN_FLAG, self::CORE_FLAG ]; - $woo_options = parse_ini_file( __DIR__ . '/../../../blocks.ini' ); + $woo_options = parse_ini_file( __DIR__ . '/../../../../blocks.ini' ); $this->flag = is_array( $woo_options ) && in_array( intval( $woo_options['woocommerce_blocks_phase'] ), $allowed_flags, true ) ? $woo_options['woocommerce_blocks_phase'] : $default_flag; } else { $this->flag = $default_flag; @@ -64,9 +64,9 @@ class FeatureGating { */ public function load_environment() { if ( 'unset' === $this->environment ) { - if ( file_exists( __DIR__ . '/../../../blocks.ini' ) ) { + if ( file_exists( __DIR__ . '/../../../../blocks.ini' ) ) { $allowed_environments = [ self::PRODUCTION_ENVIRONMENT, self::DEVELOPMENT_ENVIRONMENT, self::TEST_ENVIRONMENT ]; - $woo_options = parse_ini_file( __DIR__ . '/../../../blocks.ini' ); + $woo_options = parse_ini_file( __DIR__ . '/../../../../blocks.ini' ); $this->environment = is_array( $woo_options ) && in_array( $woo_options['woocommerce_blocks_env'], $allowed_environments, true ) ? $woo_options['woocommerce_blocks_env'] : self::PRODUCTION_ENVIRONMENT; } else { $this->environment = self::PRODUCTION_ENVIRONMENT; @@ -171,8 +171,8 @@ class FeatureGating { * @return boolean */ public function is_block_templates_controller_refactor_enabled() { - if ( file_exists( __DIR__ . '/../../../blocks.ini' ) ) { - $conf = parse_ini_file( __DIR__ . '/../../../blocks.ini' ); + if ( file_exists( __DIR__ . '/../../../../blocks.ini' ) ) { + $conf = parse_ini_file( __DIR__ . '/../../../../blocks.ini' ); return $this->is_development_environment() && isset( $conf['use_block_templates_controller_refactor'] ) && true === (bool) $conf['use_block_templates_controller_refactor']; } return false; diff --git a/plugins/woocommerce/woocommerce.php b/plugins/woocommerce/woocommerce.php index 7eedfa62a69..6fc6ad5eaa2 100644 --- a/plugins/woocommerce/woocommerce.php +++ b/plugins/woocommerce/woocommerce.php @@ -20,6 +20,10 @@ if ( ! defined( 'WC_PLUGIN_FILE' ) ) { define( 'WC_PLUGIN_FILE', __FILE__ ); } +if ( ! defined( 'WC_BLOCKS_IS_FEATURE_PLUGIN' ) ) { + define( 'WC_BLOCKS_IS_FEATURE_PLUGIN', true ); +} + // Load core packages and the autoloader. require __DIR__ . '/src/Autoloader.php'; require __DIR__ . '/src/Packages.php';