-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds compat checker for versioning and compatibility #2640
Conversation
facebook-for-woocommerce.php
Outdated
@@ -127,7 +129,7 @@ public function __wakeup() { | |||
*/ | |||
public function init_plugin() { | |||
|
|||
if ( ! $this->plugins_compatible() ) { | |||
if ( ! Checker::instance()->is_compatible( __FILE__, self::PLUGIN_VERSION ) || ! $this->plugins_compatible() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't Checker::instance()->is_compatible( FILE, self::PLUGIN_VERSION ) move inside plugins_compatible ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good catch, @rawdreeg. My approach was not to disturb existing checks. However, in this case, we can remove the plugins_compatible
method and replace it with Checker::instance()->is_compatible( FILE, self::PLUGIN_VERSION )
alone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've implemented the above suggestion in this commit: 8eefaf3
Co-authored-by: Rodrigue <rodrigue.tusse@automattic.com>
Thank you, @rawdreeg, for taking the time to review the PR. I've pushed a couple of commits addressing your comments. Please let me know your thoughts. |
@@ -127,7 +129,7 @@ public function __wakeup() { | |||
*/ | |||
public function init_plugin() { | |||
|
|||
if ( ! $this->plugins_compatible() ) { | |||
if ( ! Checker::instance()->is_compatible( __FILE__, self::PLUGIN_VERSION ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably means we can remove plugins_compatible as this is a private method and it's no longer used :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, Thanks @ibndawood . I added a suggestion to remove the plugins_compatible method. but that's left up to you :-)
Changes proposed in this Pull Request:
Closes #2639.
This PR uses the
compat-checker
library from the WooCommerce Grow repo to run compatibility and versioning checks during the plugin initialisation.Checks:
Screenshots:
Screenshots are for reference. WooCommerce Brands will be replaced by Facebook for WooCommerce.
WooCommerce not installed
WooCommerce not activated
WooCommerce not compatible
WooCommerce not tested
Detailed test instructions:
Pre-requisites
The PR requires deleting transients. A plugin like Transients Manager is recommended to delete the transients between tests.
WooCommerce activation tests
With the above code snippets in place, run the following tests. The instructions are for Facebook for WooCommerce but can be used for other WooGrow Extensions.
Facebook for WooCommerce requires WooCommerce to be installed and activated. Please install WooCommerce.
is displayed.Facebook for WooCommerce requires WooCommerce to be activated. Please activate WooCommerce.
is displayed.WooCommerce versioning tests
_transient_wc_grow_compat_checker_[EXTENSION].php[VERSION
after each change!!WC requires at least
header field and set it to a version higher than the active WooCommerce version. Let's say theWC requires at least
is set to8.2
and the active WooCommerce version is8.0.2
.Facebook for WooCommerce requires WooCommerce version 8.2 or higher. Please update WooCommerce to the latest version, or download the minimum required version
is displayed.WC tested up to
and set it to a lower version than the active WooCommerce version. Let's say theWC tested up to
is set to7.8
, the active WooCommerce version is8.0.2
and Facebook for WooCommerce version is3.0.34
.Facebook for WooCommerce - 3.0.34 is untested with WooCommerce 8.0.2
is displayed.L2 support recommendation notice
7.6
.Heads up! Facebook for WooCommerce will soon discontinue support for WooCommerce 7.6. Please update WooCommerce to take advantage of the latest updates and features.
WordPress versioning tests
_transient_wc_grow_compat_checker_[EXTENSION].php[VERSION
after each change!!Tested up to
and set it to a lower version than the current WordPress version. Let's say theTested up to
is set to6.2
, the active WordPress version is6.3
, and the Facebook for WooCommerce version is3.0.34
.Facebook for WooCommerce - 3.0.34 is untested with WordPress 6.3
is displayed.Additional Details
To delete a transient using Transients Manager, navigate to Tools > Transients, search for
wc_grow
and delete the transient.Changelog entry