-
Notifications
You must be signed in to change notification settings - Fork 315
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
Changes from 6 commits
1ecc579
bce6f63
76d884f
e9ddfa8
534ebba
c9630f8
9d95965
fd20a0e
9868f20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ class Features { | |
* @since 2.1 | ||
*/ | ||
public function setup() { | ||
// hooks order matters, make sure feature activation goes before features setup | ||
add_action( 'init', array( $this, 'handle_feature_activation' ), 0 ); | ||
add_action( 'init', array( $this, 'setup_features' ), 0 ); | ||
} | ||
|
@@ -196,10 +195,12 @@ public function handle_feature_activation() { | |
$new_requirement_statuses[ $slug ] = (int) $status->code; | ||
} | ||
|
||
if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) { | ||
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 commentThe 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:
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 commentThe reason will be displayed to describe this comment to others. Learn more. I've updated to check for a WP-CLI context |
||
if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) { | ||
update_site_option( 'ep_feature_requirement_statuses', $new_requirement_statuses ); | ||
} else { | ||
update_option( 'ep_feature_requirement_statuses', $new_requirement_statuses ); | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -231,7 +232,7 @@ public function handle_feature_activation() { | |
* If a requirement status changes, we need to handle that by activating/deactivating/showing notification | ||
*/ | ||
|
||
if ( ! empty( $old_requirement_statuses ) ) { | ||
if ( is_admin() && ! empty( $old_requirement_statuses ) ) { | ||
foreach ( $new_requirement_statuses as $slug => $code ) { | ||
$feature = $this->get_registered_feature( $slug ); | ||
|
||
|
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 😬