From 386d0db96942571f92ceb142e28e589fbb19fdd1 Mon Sep 17 00:00:00 2001 From: Christopher Allford <6451942+ObliviousHarmony@users.noreply.github.com> Date: Sat, 9 Dec 2023 21:03:34 -0800 Subject: [PATCH] Fixed Blocks Dependency Check Since we've merged it into WooCommerce Core there's nothing for us to bother checking it against. --- .../src/Blocks/Domain/Bootstrap.php | 63 +++++-------------- 1 file changed, 14 insertions(+), 49 deletions(-) diff --git a/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php b/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php index 4b40fd32ee6..a255178ed57 100644 --- a/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php +++ b/plugins/woocommerce/src/Blocks/Domain/Bootstrap.php @@ -77,22 +77,20 @@ class Bootstrap { $this->package = $container->get( Package::class ); $this->migration = $container->get( Migration::class ); - if ( $this->has_core_dependencies() ) { - $this->init(); - /** - * Fires when the woocommerce blocks are loaded and ready to use. - * - * This hook is intended to be used as a safe event hook for when the plugin - * has been loaded, and all dependency requirements have been met. - * - * To ensure blocks are initialized, you must use the `woocommerce_blocks_loaded` - * hook instead of the `plugins_loaded` hook. This is because the functions - * hooked into plugins_loaded on the same priority load in an inconsistent and unpredictable manner. - * - * @since 2.5.0 - */ - do_action( 'woocommerce_blocks_loaded' ); - } + $this->init(); + /** + * Fires when the woocommerce blocks are loaded and ready to use. + * + * This hook is intended to be used as a safe event hook for when the plugin + * has been loaded, and all dependency requirements have been met. + * + * To ensure blocks are initialized, you must use the `woocommerce_blocks_loaded` + * hook instead of the `plugins_loaded` hook. This is because the functions + * hooked into plugins_loaded on the same priority load in an inconsistent and unpredictable manner. + * + * @since 2.5.0 + */ + do_action( 'woocommerce_blocks_loaded' ); } /** @@ -161,39 +159,6 @@ class Bootstrap { } } - /** - * Check core dependencies exist. - * - * @return boolean - */ - protected function has_core_dependencies() { - $has_needed_dependencies = class_exists( 'WooCommerce', false ); - if ( $has_needed_dependencies ) { - $plugin_data = \get_file_data( - $this->package->get_path( 'woocommerce-gutenberg-products-block.php' ), - [ - 'RequiredWCVersion' => 'WC requires at least', - ] - ); - if ( isset( $plugin_data['RequiredWCVersion'] ) && version_compare( \WC()->version, $plugin_data['RequiredWCVersion'], '<' ) ) { - $has_needed_dependencies = false; - add_action( - 'admin_notices', - function() { - if ( should_display_compatibility_notices() ) { - ?> -
-

-
-