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

Remove 3.1.13 update step from lifecycle #2736

Merged
merged 2 commits into from
May 7, 2024

Conversation

layoutd
Copy link
Collaborator

@layoutd layoutd commented May 7, 2024

Changes proposed in this Pull Request:

As reported in the forums: https://wordpress.org/support/topic/php-fatal-error-uncaught-error-class-woocommerce/

If a merchant has Facebook for WooCommerce < 3.1.13 and Messenger enabled, and then updates directly to ≥ 3.2.0, an error is triggered during the update lifecycle process due to a class that was removed in 3.2.0 being referenced in the update step for 3.1.13.

This PR removes the 3.1.13 update step altogether, as it just added an notice warning about the upcoming May 2024 deprecation of the Facebook Messenger chat plugin. Since we're now past that date, there's no reason to even consider it. It is mentioned in the 3.2.0 update method, however, since it's possible that users that update < 3.1.13 → 3.1.13-3.1.15 will have the deprecation notice, so updating again to ≥ 3.2.0 should still remove it.

Detailed test instructions:

To reproduce:

  1. Install and activate v3.2.0.
  2. In include/Lifecycle.php, set $is_messenger_enabled = true; to force the condition.
  3. Downgrade the version in facebook-for-woocommerce.php to 3.1.11 in the docs and the version constant:
# Line 14
 * Version: 3.1.11
# Line 48
	const PLUGIN_VERSION = '3.1.11'; // WRCS: DEFINED_VERSION.
  1. Update the FB version DB options:
UPDATE `wp_options` SET `option_value` = '3.1.11' WHERE `option_name` = 'wc_facebook_for_woocommerce_version';
UPDATE `wp_options` SET `option_value` = '[]' WHERE `option_name` = 'wc_facebook_for_woocommerce_lifecycle_events';

SELECT * FROM `wp_options` WHERE option_name IN ('wc_facebook_for_woocommerce_version', 'wc_facebook_for_woocommerce_lifecycle_events');
  1. Confirm the version is 3.1.11:
    image
  2. Revert the values from step 3 to 3.2.0
  3. Confirm the error in WP Admin:
Fatal error: Uncaught Error: Class "WooCommerce\Facebook\Admin\Settings_Screens\Messenger" not found in /var/www/html/wp-content/plugins/facebook-for-woocommerce/includes/Lifecycle.php:321

To confirm fix:

  1. Checkout this PR branch.
  2. Repeat steps 3 - 6 above. (Note that step 2 isn't necessary as the code is no longer present).
  3. Confirm version is updated to 3.2.0 correctly.

Changelog entry

Fix - Direct upgrade path from < 3.1.13 to ≥ 3.2.0.

@layoutd layoutd added the changelog: fix Took care of something that wasn't working. label May 7, 2024
@layoutd layoutd self-assigned this May 7, 2024
@layoutd layoutd requested a review from a team May 7, 2024 09:21
@github-actions github-actions bot added the type: bug The issue is a confirmed bug. label May 7, 2024
Copy link
Collaborator

@budzanowski budzanowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Will fix the error.

@layoutd layoutd merged commit 2f8e01e into develop May 7, 2024
5 checks passed
@layoutd layoutd deleted the fix/skip-upgrade-step-for-3.2.0 branch May 7, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants