ActionScheduler_ActionFactory::recurring_unique()publicWC 1.0

Create the first instance of an action recurring on a given interval 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->recurring_unique( $hook, $args, $first, $interval, $group, $unique );
$hook(строка) (обязательный)
The hook to trigger when this action runs.
$args(массив)
Args to pass when the hook is triggered.
По умолчанию: array()
$first(int)
Unix timestamp for the first run.
По умолчанию: null
$interval(int)
Seconds between runs.
По умолчанию: null
$group(строка)
A group to put the action in.
По умолчанию: ''
$unique(true|false)
Whether action scheduled should be unique.
По умолчанию: true

Код ActionScheduler_ActionFactory::recurring_unique() WC 8.7.0

public function recurring_unique( $hook, $args = array(), $first = null, $interval = null, $group = '', $unique = true ) {
	if ( empty( $interval ) ) {
		return $this->single_unique( $hook, $args, $first, $group, $unique );
	}
	$date     = as_get_datetime_object( $first );
	$schedule = new ActionScheduler_IntervalSchedule( $date, $interval );
	$action   = new ActionScheduler_Action( $hook, $args, $schedule, $group );
	return $unique ? $this->store_unique_action( $action ) : $this->store( $action );
}