Avoid redundant/unnecessary cleanup. (https://github.com/woocommerce/woocommerce-admin/pull/3580)
The feature plugin doesn't need to clean up when the core package exists.
This commit is contained in:
parent
92af5964fb
commit
3b609cf19f
|
@ -96,6 +96,12 @@ class FeaturePlugin {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function on_deactivation() {
|
public function on_deactivation() {
|
||||||
|
// Don't clean up if the WooCommerce Admin package is in core.
|
||||||
|
// NOTE: Any future divergence from the core package will need to be accounted for here.
|
||||||
|
if ( defined( 'WC_ADMIN_PACKAGE_EXISTS' ) && WC_ADMIN_PACKAGE_EXISTS ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we are deactivating due to dependencies not being satisfied.
|
// Check if we are deactivating due to dependencies not being satisfied.
|
||||||
// If WooCommerce is disabled we can't include files that depend upon it.
|
// If WooCommerce is disabled we can't include files that depend upon it.
|
||||||
if ( ! $this->has_satisfied_dependencies() ) {
|
if ( ! $this->has_satisfied_dependencies() ) {
|
||||||
|
|
|
@ -379,6 +379,7 @@ class Install {
|
||||||
if ( ! wp_next_scheduled( 'wc_admin_daily' ) ) {
|
if ( ! wp_next_scheduled( 'wc_admin_daily' ) ) {
|
||||||
wp_schedule_event( time(), 'daily', 'wc_admin_daily' );
|
wp_schedule_event( time(), 'daily', 'wc_admin_daily' );
|
||||||
}
|
}
|
||||||
|
// @todo This is potentially redundant when the core package exists.
|
||||||
wp_schedule_single_event( time() + 10, 'generate_category_lookup_table' );
|
wp_schedule_single_event( time() + 10, 'generate_category_lookup_table' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,11 @@ class Package {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Indicate to the feature plugin that the core package exists.
|
||||||
|
if ( ! defined( 'WC_ADMIN_PACKAGE_EXISTS' ) ) {
|
||||||
|
define( 'WC_ADMIN_PACKAGE_EXISTS', true );
|
||||||
|
}
|
||||||
|
|
||||||
// Avoid double initialization when the feature plugin is in use.
|
// Avoid double initialization when the feature plugin is in use.
|
||||||
if ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
|
if ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue