Refactor deactivation logic to unschedule additional actions

Made the `deactivation` method public and added calls to unschedule specific actions related to email dispatch and account status checks. This ensures proper cleanup of scheduled tasks during plugin deactivation.
This commit is contained in:
Mykyta Synelnikov
2025-05-19 16:19:23 +03:00
parent d54a4117be
commit d40cb941c0
+5 -3
View File
@@ -370,16 +370,18 @@ if ( ! class_exists( 'UM' ) ) {
}
}
/**
* Plugin Deactivation
*
* @since 2.3
*/
function deactivation() {
public function deactivation() {
$this->cron()->unschedule_events();
}
$this->maybe_action_scheduler()->unschedule_all_actions( 'um_dispatch_email' );
$this->maybe_action_scheduler()->unschedule_all_actions( 'um_schedule_empty_account_status_check' );
$this->maybe_action_scheduler()->unschedule_all_actions( 'um_set_default_account_status' );
}
/**
* Maybe need multisite activation process