-
Notifications
You must be signed in to change notification settings - Fork 313
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
Change the moment we check for activate/deactivate features #2410
Change the moment we check for activate/deactivate features #2410
Conversation
@felipeelia I changed a little bit the initial approach in this PR. Moving the functions So, instead of moving to |
includes/classes/Features.php
Outdated
@@ -31,7 +31,6 @@ class Features { | |||
* @since 2.1 | |||
*/ | |||
public function setup() { | |||
// hooks order matters, make sure feature activation goes before features setup |
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 actually a comment we should keep, shouldn't we @Rahmon ?
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.
Yes. I added back 😬
includes/classes/Features.php
Outdated
update_site_option( 'ep_feature_requirement_statuses', $new_requirement_statuses ); | ||
} else { | ||
update_option( 'ep_feature_requirement_statuses', $new_requirement_statuses ); | ||
if ( is_admin() ) { |
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.
As is, this seems to be breaking WP-CLI index. These are the steps to reproduce the problem I'm seeing @Rahmon:
- Create a multisite, enable EP for the entire network and WooCommerce just on the main site
- Run
wp elasticpress index --setup --network-wide --yes
- Visit
/?s=woo-hoodie&post_type=product
in the main site and see 3 products (found by SKU) - Visit
/wp-admin/plugins.php?plugin_status=all&paged=1&s
in the second site (the one without WC) - Run
wp elasticpress index --setup --network-wide --yes
again - Visit
/?s=woo-hoodie&post_type=product
in the main site and see no product found
It seems #4 removes the WC feature (what would be expected, as WC is not available on that site), and then on #5 (as the WC feature is inactive) SKUs are not indexed.
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 updated to check for a WP-CLI context
Description of the Change
This PR changes the moment we check for activate/deactivate features updating the hook from
init
toadmin_init
on the class Features.Alternate Designs
Benefits
Possible Drawbacks
The check for activate/deactivate features will not run on WP-CLI commands.
Verification Process
Checklist:
Applicable Issues
Closes: #2362
Changelog Entry