Check if dependencies are met before running deactivation hook (https://github.com/woocommerce/woocommerce-admin/pull/1797)

This commit is contained in:
Joshua T Flowers 2019-03-15 09:26:29 +08:00 committed by GitHub
parent 26de74dc30
commit 53f84e1b5d
1 changed files with 4 additions and 2 deletions

View File

@ -123,8 +123,10 @@ add_action( 'admin_init', 'wc_admin_possibly_deactivate_wc_admin_plugin' );
* On deactivating the wc-admin plugin. * On deactivating the wc-admin plugin.
*/ */
function wc_admin_deactivate_wc_admin_plugin() { function wc_admin_deactivate_wc_admin_plugin() {
if ( wc_admin_dependencies_satisfied() ) {
wp_clear_scheduled_hook( 'wc_admin_daily' ); wp_clear_scheduled_hook( 'wc_admin_daily' );
WC_Admin_Reports_Sync::clear_queued_actions(); WC_Admin_Reports_Sync::clear_queued_actions();
}
} }
register_deactivation_hook( WC_ADMIN_PLUGIN_FILE, 'wc_admin_deactivate_wc_admin_plugin' ); register_deactivation_hook( WC_ADMIN_PLUGIN_FILE, 'wc_admin_deactivate_wc_admin_plugin' );