ActionScheduler_ActionFactory::single_unique()
Create single action only if there is no pending or running action with same name and params.
Метод класса: ActionScheduler_ActionFactory{}
Хуков нет.
Возвращает
int
. The ID of the stored action.
Использование
$ActionScheduler_ActionFactory = new ActionScheduler_ActionFactory(); $ActionScheduler_ActionFactory->single_unique( $hook, $args, $when, $group, $unique );
- $hook(строка) (обязательный)
- The hook to trigger when this action runs.
- $args(массив)
- Args to pass when the hook is triggered.
По умолчанию: array() - $when(int)
- Unix timestamp when the action will run.
По умолчанию: null - $group(строка)
- A group to put the action in.
По умолчанию: '' - $unique(true|false)
- Whether action scheduled should be unique.
По умолчанию: true
Код ActionScheduler_ActionFactory::single_unique() ActionScheduler ActionFactory::single unique WC 9.2.3
public function single_unique( $hook, $args = array(), $when = null, $group = '', $unique = true ) { $date = as_get_datetime_object( $when ); $schedule = new ActionScheduler_SimpleSchedule( $date ); $action = new ActionScheduler_Action( $hook, $args, $schedule, $group ); return $unique ? $this->store_unique_action( $action ) : $this->store( $action ); }