From bbea469ed92ef02a3afc1be831b70069104586be Mon Sep 17 00:00:00 2001 From: Richard Wawrzyniak Date: Tue, 4 Aug 2020 09:25:55 +0100 Subject: [PATCH 1/2] Fix fatal error when using add-on slug --- includes/class-gf-cli-root.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/class-gf-cli-root.php b/includes/class-gf-cli-root.php index 77134b5..c101fee 100644 --- a/includes/class-gf-cli-root.php +++ b/includes/class-gf-cli-root.php @@ -29,14 +29,14 @@ class GF_CLI_Root extends WP_CLI_Command { * wp gf version gravityformspolls */ public function version( $args, $assoc_args ) { + if ( ! class_exists( 'GFForms' ) ) { + WP_CLI::error( 'Gravity Forms is not installed. Use the wp gf install command.' ); + } + $slug = $this->get_slug( $args ); if ( $slug == 'gravityforms' ) { - if ( class_exists( 'GFForms' ) ) { - WP_CLI::log( GFForms::$version ); - } else { - WP_CLI::error( 'Gravity Forms is not installed. Use the wp gf install command.' ); - } + WP_CLI::log( GFForms::$version ); } else { $addon_class_names = GFAddOn::get_registered_addons(); $addon_found = false; From 77cff5cd5577b70ac84dc048dd1a4f3e125ba75f Mon Sep 17 00:00:00 2001 From: Richard Wawrzyniak Date: Tue, 4 Aug 2020 09:27:35 +0100 Subject: [PATCH 2/2] update change log --- change_log.txt | 1 + readme.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/change_log.txt b/change_log.txt index 6712549..fd0db35 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,5 +1,6 @@ = 1.3.1 = - Added support for using `--version=beta` with the `wp gf install` and `wp gf update` commands. Add-On beta releases are not currently supported. +- Fixed a fatal error which can occur when using the `wp gf version` command with an add-on slug when Gravity Forms is not active or not installed. = 1.3 = - Fixed an error occurring when using the `wp gf form notification create` command. diff --git a/readme.txt b/readme.txt index ff6bd94..ae98b80 100644 --- a/readme.txt +++ b/readme.txt @@ -187,6 +187,7 @@ If you have any ideas for improvements please submit your idea at https://www.gr = 1.3.1 = - Added support for using `--version=beta` with the `wp gf install` and `wp gf update` commands. Add-On beta releases are not currently supported. +- Fixed a fatal error which can occur when using the `wp gf version` command with an add-on slug when Gravity Forms is not active or not installed. = 1.3 = - Fixed an error occurring when using the `wp gf form notification create` command.