ActionScheduler_IntervalSchedule
ActionScheduler_IntervalSchedule represents a recurring schedule that runs at fixed intervals measured in seconds.
Class definition
class ActionScheduler_IntervalSchedule extends ActionScheduler_Abstract_RecurringSchedule implements ActionScheduler_Schedule {
protected function calculate_next( DateTime $after );
public function interval_in_seconds();
public function __sleep();
public function __wakeup();
}
When it’s used
Use this schedule for recurring actions that run every N seconds (e.g., hourly, daily).
Construction
public function __construct( DateTime $date, $recurrence, ?DateTime $first = null );
$dateis the scheduled run time for this instance.$recurrenceis the interval in seconds.$first(optional) is the date/time the first instance ran; defaults to$date.
Next-run calculation
calculate_next() adds the interval to the provided $after:
$after->modify( '+' . (int) $this->get_recurrence() . ' seconds' );
So get_next( DateTime $after ) (from ActionScheduler_Abstract_Schedule) returns:
- the stored schedule date if
$afteris before or equal to the scheduled date - otherwise
$after + interval
Recurrence
is_recurring()is inherited and returnstrue.get_recurrence()returns the interval in seconds (as stored on the base class).
Deprecated helper
interval_in_seconds() is deprecated and returns (int) $this->get_recurrence().
Serialization compatibility
__sleep()/__wakeup() preserve compatibility with schedules serialized before Action Scheduler 3.0.0 by mapping legacy property names (start_timestamp, interval_in_seconds).