Remove table data on plugin deactivate

This commit is contained in:
Joshua Flowers 2019-06-12 13:04:06 +08:00 committed by Jeff Stieler
parent ea12ad086b
commit 9028488548
1 changed files with 11 additions and 0 deletions

View File

@ -56,6 +56,7 @@ class WC_Admin_Feature_Plugin {
public function init() {
$this->define_constants();
register_activation_hook( WC_ADMIN_PLUGIN_FILE, array( $this, 'on_activation' ) );
register_deactivation_hook( WC_ADMIN_PLUGIN_FILE, array( $this, 'on_deactivation' ) );
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
add_filter( 'action_scheduler_store_class', array( $this, 'replace_actionscheduler_store_class' ) );
}
@ -71,6 +72,16 @@ class WC_Admin_Feature_Plugin {
WC_Admin_Install::create_events();
}
/**
* Remove WooCommerce Admin related table data.
*
* @return void
*/
public function on_deactivation() {
require_once WC_ADMIN_ABSPATH . 'includes/class-wc-admin-install.php';
WC_Admin_Install::delete_table_data();
}
/**
* Setup plugin once all other plugins are loaded.
*