ActionScheduler_ActionFactory::cron_unique
Method of the class: ActionScheduler_ActionFactory{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ActionScheduler_ActionFactory = new ActionScheduler_ActionFactory(); $ActionScheduler_ActionFactory->cron_unique( $hook, $args, $base_timestamp, $schedule, $group, $unique );
- $hook(required)
- .
- $args
- .
Default:array() - $base_timestamp
- .
Default:null - $schedule
- .
Default:null - $group
- .
Default:'' - $unique
- .
Default:true
ActionScheduler_ActionFactory::cron_unique() ActionScheduler ActionFactory::cron unique code WC 10.7.0
public function cron_unique( $hook, $args = array(), $base_timestamp = null, $schedule = null, $group = '', $unique = true ) {
if ( empty( $schedule ) ) {
return $this->single_unique( $hook, $args, $base_timestamp, $group, $unique );
}
$date = as_get_datetime_object( $base_timestamp );
$cron = CronExpression::factory( $schedule );
$schedule = new ActionScheduler_CronSchedule( $date, $cron );
$action = new ActionScheduler_Action( $hook, $args, $schedule, $group );
return $unique ? $this->store_unique_action( $action ) : $this->store( $action );
}