Fixed Blocks INI File Path

This commit is contained in:
Christopher Allford 2023-12-09 21:33:34 -08:00
parent e34361695d
commit b4fd0c3b7b
4 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -4,6 +4,7 @@
# Built JS
/assets/js/*
/assets/client/*
/blocks.ini
# Behat/CLI Tests
tests/cli/installer

View File

@ -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;

View File

@ -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';