PHP Класс Automattic\WP\Cron_Control\Events

Наследование: extends Singleton
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
get_event ( $timestamp, $action_hashed, $instance ) Find an event's data using its hashed representations
get_events ( ) List events pending for the current period
get_lock_key_for_event_action ( $event ) : string Turn the event action into a string that can be used with a lock
prepare_environment ( ) Prepare environment to run job
run_event ( $timestamp, $action, $instance, $force = false ) : array | WP_Error Execute a specific event

Защищенные методы

Метод Описание
class_init ( ) Register hooks

Приватные методы

Метод Описание
action_has_callback_or_should_run_anyway ( $event ) : boolean Check that an event has a callback to run, and allow the check to be overridden Empty events are, by default, skipped and removed/rescheduled
can_run_event ( $event ) : boolean Are resources available to run this event?
do_lock_cleanup ( $event ) Free locks after event completes
prime_event_action_lock ( $event ) Prime the event-specific lock
reduce_queue ( $events ) : array Trim events queue down to the limit set by JOB_QUEUE_SIZE
reset_event_lock ( $event ) : boolean Frees the lock for an individual event
update_event_record ( $event ) Mark an event completed, and reschedule when requested

Описание методов

class_init() защищенный метод

Register hooks
protected class_init ( )

get_event() публичный метод

The $instance argument is hashed for us by Core, while we hash the action to avoid information disclosure
public get_event ( $timestamp, $action_hashed, $instance )

get_events() публичный метод

List events pending for the current period
public get_events ( )

get_lock_key_for_event_action() публичный метод

Turn the event action into a string that can be used with a lock
public get_lock_key_for_event_action ( $event ) : string
$event array Event data
Результат string

prepare_environment() публичный метод

Must run as early as possible, particularly before any client code is loaded This also runs before Core has parsed the request and set the \REST_REQUEST constant
public prepare_environment ( )

run_event() публичный метод

Execute a specific event
public run_event ( $timestamp, $action, $instance, $force = false ) : array | WP_Error
$timestamp int Unix timestamp
$action string md5 hash of the action used when the event is registered
$instance string md5 hash of the event's arguments array, which Core uses to index the `cron` option
$force bool Run event regardless of timestamp or lock status? eg, when executing jobs via wp-cli
Результат array | WP_Error