/** * Identify jobs unscheduled using `wp_unschedule_event()` by comparing current value with previous */ private function find_unscheduled_jobs($new, $old) { $differences = array(); $old = collapse_events_array($old); foreach ($old as $event) { $timestamp = $event['timestamp']; $action = $event['action']; $instance = $event['instance']; if (!isset($new[$timestamp][$action][$instance])) { $differences[] = array('timestamp' => $timestamp, 'action' => $action, 'instance' => $instance); } } return $differences; }
/** * Find an event's data using its hashed representations * * The `$instance` argument is hashed for us by Core, while we hash the action to avoid information disclosure */ public function get_event($timestamp, $action_hashed, $instance) { $events = get_option('cron'); $event = false; $filtered_events = collapse_events_array($events, $timestamp); foreach ($filtered_events as $filtered_event) { if (hash_equals(md5($filtered_event['action']), $action_hashed) && hash_equals($filtered_event['instance'], $instance)) { $event = $filtered_event['args']; $event['timestamp'] = $filtered_event['timestamp']; $event['action'] = $filtered_event['action']; $event['instance'] = $filtered_event['instance']; break; } } return $event; }