Skip to content
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

Merged
merged 9 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions class-wc-facebookcommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
* @package FacebookCommerce
*/

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/includes/fbutils.php';
require_once __DIR__ . '/includes/fbutils.php';
ibndawood marked this conversation as resolved.
Show resolved Hide resolved

use Automattic\WooCommerce\Admin\Features\Features as WooAdminFeatures;
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskLists;
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
{
"type": "vcs",
"url": "https://github.com/woocommerce/action-scheduler-job-framework"
},
{
"type": "vcs",
"url": "https://github.com/woocommerce/grow"
}
],
"require": {
"php": ">=7.4",
"woocommerce/action-scheduler-job-framework": "2.0.0",
"composer/installers": "~1.0"
"composer/installers": "~1.0",
"woocommerce/grow": "dev-compat-checker"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^v0.7",
Expand Down
107 changes: 71 additions & 36 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions facebook-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* @package FacebookCommerce
*/

require_once __DIR__ . '/vendor/autoload.php';

use Automattic\WooCommerce\Grow\Tools\CompatChecker\v0_0_1\Checker;
use Automattic\WooCommerce\Utilities\FeaturesUtil;

defined( 'ABSPATH' ) || exit;
Expand Down Expand Up @@ -88,7 +91,6 @@ protected function __construct() {

add_action( 'admin_init', array( $this, 'check_environment' ) );

add_action( 'admin_notices', array( $this, 'add_plugin_notices' ) ); // admin_init is too early for the get_current_screen() function.
add_action( 'admin_notices', array( $this, 'admin_notices' ), 15 );

// If the environment check fails, initialize the plugin.
Expand Down Expand Up @@ -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() ) {
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

return;
}

Expand Down
Loading