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

Change the moment we check for activate/deactivate features #2410

Merged
14 changes: 9 additions & 5 deletions includes/classes/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,14 @@ 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 );
$is_wp_cli = defined( 'WP_CLI' ) && \WP_CLI;

if ( $is_wp_cli || is_admin() ) {
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 );
}
}

/**
Expand Down Expand Up @@ -231,7 +235,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_wp_cli || is_admin() ) && ! empty( $old_requirement_statuses ) ) {
foreach ( $new_requirement_statuses as $slug => $code ) {
$feature = $this->get_registered_feature( $slug );

Expand Down