ActionScheduler_Abstract_QueueRunner::process_action()
Process an individual action.
Метод класса: ActionScheduler_Abstract_QueueRunner{}
Хуки из метода
Возвращает
null
. Ничего.
Использование
$ActionScheduler_Abstract_QueueRunner = new ActionScheduler_Abstract_QueueRunner(); $ActionScheduler_Abstract_QueueRunner->process_action( $action_id, $context );
- $action_id(int) (обязательный)
- The action ID to process.
- $context(строка)
- Optional identifer for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' Generally, this should be capitalised and not localised as it's a proper noun.
По умолчанию: ''
Код ActionScheduler_Abstract_QueueRunner::process_action() ActionScheduler Abstract QueueRunner::process action WC 7.7.0
public function process_action( $action_id, $context = '' ) { try { $valid_action = false; do_action( 'action_scheduler_before_execute', $action_id, $context ); if ( ActionScheduler_Store::STATUS_PENDING !== $this->store->get_status( $action_id ) ) { do_action( 'action_scheduler_execution_ignored', $action_id, $context ); return; } $valid_action = true; do_action( 'action_scheduler_begin_execute', $action_id, $context ); $action = $this->store->fetch_action( $action_id ); $this->store->log_execution( $action_id ); $action->execute(); do_action( 'action_scheduler_after_execute', $action_id, $action, $context ); $this->store->mark_complete( $action_id ); } catch ( Exception $e ) { if ( $valid_action ) { $this->store->mark_failure( $action_id ); do_action( 'action_scheduler_failed_execution', $action_id, $e, $context ); } else { do_action( 'action_scheduler_failed_validation', $action_id, $e, $context ); } } if ( isset( $action ) && is_a( $action, 'ActionScheduler_Action' ) && $action->get_schedule()->is_recurring() ) { $this->schedule_next_instance( $action, $action_id ); } }