* Remove data related to how Core manages cron in the absence of this plugin */ public function clean_legacy_data() { // Cron option can be very large, so it shouldn't linger delete_option('cron'); // While this plugin doesn't use this locking mechanism, other code may check the value if (wp_using_ext_object_cache()) { wp_cache_delete('doing_cron', 'transient'); } else { delete_transient('doing_cron'); } } /** * Delete event objects for events that have run * * Given volume of events that can be created, waiting for `wp_scheduled_delete()`, which defaults to a trailing 30-day delete, is unwise */ public function purge_completed_events() { $trashed_posts = get_posts(array('post_type' => Cron_Options_CPT::POST_TYPE, 'post_status' => Cron_Options_CPT::POST_STATUS_COMPLETED, 'posts_per_page' => 100, 'fields' => 'ids')); if (is_array($trashed_posts) && !empty($trashed_posts)) { foreach ($trashed_posts as $trashed_post_id) { wp_delete_post($trashed_post_id, true); do_action('a8c_cron_control_purged_completed_event', $trashed_post_id); } } } } Internal_Events::instance();
/** * Check if an event is an internal one that the plugin will always run */ function is_internal_event($action) { return Internal_Events::instance()->is_internal_event($action); }