Skip to content

Commit 2b29fa6

Browse files
author
Marco Pereirinha
committed
Clean up legacy cron jobs
1 parent 1f1fed0 commit 2b29fa6

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

php/class-deactivation.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ protected function cleanup() {
480480
$this->drop_tables();
481481
$this->cleanup_options();
482482
$this->cleanup_cron();
483+
$this->cleanup_legacy_cron();
483484

484485
// If we got this far, let's remove the cron event.
485486
wp_clear_scheduled_hook( 'cloudinary_cleanup_event' );
@@ -625,4 +626,27 @@ protected function cleanup_cron() {
625626
// Delete the cron schedule option saved in database.
626627
delete_option( Cron::CRON_META_KEY );
627628
}
629+
630+
/**
631+
* Cleanup legacy cron jobs.
632+
*
633+
* @return void
634+
*/
635+
protected function cleanup_legacy_cron() {
636+
wp_clear_scheduled_hook( 'cloudinary_status' );
637+
638+
$jobs = array(
639+
'cloudinary_rest_api_connectivity',
640+
'cloudinary_resume_queue',
641+
'cloudinary_resume_upgrade',
642+
'cloudinary_sync_items',
643+
);
644+
645+
foreach ( $jobs as $job ) {
646+
$time = wp_next_scheduled( $job );
647+
if ( false !== $time ) {
648+
wp_clear_scheduled_hook( $job );
649+
}
650+
}
651+
}
628652
}

0 commit comments

Comments
 (0)