From 0080907067355d72a492a80bc80e597ec3b1a0c2 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola <grola@seostudio.pl> Date: Tue, 17 Dec 2019 13:58:00 +0000 Subject: [PATCH] Plugin version should be checked only in needed --- CHANGELOG.md | 4 ++++ src/Basic_Requirement_Checker.php | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d20b79..742a389 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [3.2.2] - 2019-12-17 +### Fixed +- Plugin version should be checked only in needed + ## [3.2.1] - 2019-11-15 ### Fixed - Fixed plugin version notice diff --git a/src/Basic_Requirement_Checker.php b/src/Basic_Requirement_Checker.php index ff0672e..36dcc61 100644 --- a/src/Basic_Requirement_Checker.php +++ b/src/Basic_Requirement_Checker.php @@ -37,6 +37,8 @@ private $min_openssl_version = null; /** @var array */ protected $plugin_require; + /** @var bool */ + protected $should_check_plugin_versions = false; /** @var array */ private $module_require; /** @var array */ @@ -119,6 +121,9 @@ * @return $this */ public function add_plugin_require( $plugin_name, $nice_plugin_name = null, $plugin_require_version = null ) { + if ( $plugin_require_version ) { + $this->should_check_plugin_versions = true; + } $this->plugin_require[ $plugin_name ] = array( self::PLUGIN_INFO_KEY_NAME => $plugin_name, self::PLUGIN_INFO_KEY_NICE_NAME => $nice_plugin_name === null ? $plugin_name : $nice_plugin_name, @@ -214,7 +219,9 @@ $notices = $this->append_plugin_require_notices( $notices ); $notices = $this->append_module_require_notices( $notices ); $notices = $this->append_settings_require_notices( $notices ); - $notices = $this->check_minimum_require_plugins_version_and_append_notices( $notices ); + if ( $this->should_check_plugin_versions ) { + $notices = $this->check_minimum_require_plugins_version_and_append_notices( $notices ); + } return $notices; } -- GitLab