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.

Method of the class: ActionScheduler_ActionFactory{}

No Hooks.

Return

Int. The ID of the stored action.

Usage

$ActionScheduler_ActionFactory = new ActionScheduler_ActionFactory();
$ActionScheduler_ActionFactory->recurring_unique( $hook, $args, $first, $interval, $group, $unique );
$hook(string) (required)
The hook to trigger when this action runs.
$args(array)
Args to pass when the hook is triggered.
Default: array()
$first(int)
Unix timestamp for the first run.
Default: null
$interval(int)
Seconds between runs.
Default: null
$group(string)
A group to put the action in.
Default: ''
$unique(true|false)
Whether action scheduled should be unique.
Default: true

ActionScheduler_ActionFactory::recurring_unique() code 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 );
}