Ensure that WooCommerce is actually active [MAILPOET-5613] #5189
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In a video you can see how MailPoet crashes during the activation of a lot of plugins. Following the related blog post I tried to replicate the issue. Sometimes it did replicate and I got the fatal error screen, sometimes it didn't.
The error is thrown in the Migrator. It states
\WC_Query_Object
not found. In the instances where I did not get the fatal error on screen, I was still able to see, that the related migration failed. I couldn't pin it down, but I assume some autoloader of one of the plugins loads theWooCommerce
class or theQuery
class without WooCommerce being active. This PR therefore strenghtens how we determine whether WooCommerce is actually active or not. With this PR I was not able to reproduce the issue and the migration worked as expected.Code review notes
N/A
QA notes
Not sure if its worth the effort to install 108 plugins and all. I would instead suggest that the normal installation activation still works as expected and that all migrations work without a failure. This PR alters a bit the behavior how we determine whether Woo is active. So it might be worth a quick look whether MailPoet still works as expected with Woo active/inactive.
Linked PRs
N/A
Linked tickets
MAILPOET-5613
After-merge notes
N/A
Tasks