From dda1d37924de3cacf8bb35f6a93a390faa34b95b Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Fri, 22 Mar 2019 10:42:01 -0400 Subject: [PATCH] Fix fatal with 1.x versions of the feature plugin (#502) * Add plugin version check to prevent fatal error with core + 1.4 * Version bump --- assets/php/class-wgpb-block-library.php | 5 +++++ package-lock.json | 2 +- package.json | 2 +- woocommerce-gutenberg-products-block.php | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/php/class-wgpb-block-library.php b/assets/php/class-wgpb-block-library.php index d0d13b714ae..811d7117b67 100644 --- a/assets/php/class-wgpb-block-library.php +++ b/assets/php/class-wgpb-block-library.php @@ -37,6 +37,11 @@ public static function get_instance() { * Constructor. */ public function __construct() { + // Shortcut out if we see the feature plugin, v1.4 or below. + // note: `FP_VERSION` is transformed to `WGPB_VERSION` in the grunt copy task. + if ( defined( 'FP_VERSION' ) && version_compare( FP_VERSION, '1.4.0', '<=' ) ) { + return; + } if ( function_exists( 'register_block_type' ) ) { add_action( 'init', array( 'WGPB_Block_Library', 'register_blocks' ) ); add_action( 'init', array( 'WGPB_Block_Library', 'register_assets' ) ); diff --git a/package-lock.json b/package-lock.json index 13a9d3024d1..8940ca909ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@woocommerce/block-library", - "version": "2.0.0-rc1", + "version": "2.0.0-rc2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4428dad79e9..c6a75076238 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@woocommerce/block-library", "title": "WooCommerce Blocks", "author": "Automattic", - "version": "2.0.0-rc1", + "version": "2.0.0-rc2", "description": "WooCommerce blocks for the Gutenberg editor.", "homepage": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/", "keywords": [ diff --git a/woocommerce-gutenberg-products-block.php b/woocommerce-gutenberg-products-block.php index 036b1c1b134..38985274855 100644 --- a/woocommerce-gutenberg-products-block.php +++ b/woocommerce-gutenberg-products-block.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Blocks * Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block * Description: WooCommerce blocks for the Gutenberg editor. - * Version: 2.0.0-rc1 + * Version: 2.0.0-rc2 * Author: Automattic * Author URI: https://woocommerce.com * Text Domain: woo-gutenberg-products-block @@ -15,7 +15,7 @@ defined( 'ABSPATH' ) || die(); -define( 'WGPB_VERSION', '2.0.0-rc1' ); +define( 'WGPB_VERSION', '2.0.0-rc2' ); define( 'WGPB_PLUGIN_FILE', __FILE__ ); define( 'WGPB_ABSPATH', dirname( WGPB_PLUGIN_FILE ) . '/' );