Properties

$first_timestamp

$first_timestamp : int

Timestamp equivalent of @see $this->first_date

Type

normal

$recurrence

$recurrence : mixed

The recurrence between each time an action is run using this schedule.

Used to calculate the start date & time. Can be a number of seconds, in the case of ActionScheduler_IntervalSchedule, or a cron expression, as in the case of ActionScheduler_CronSchedule. Or something else.

Type

normal

$scheduled_timestamp

$scheduled_timestamp : int

Timestamp equivalent of @see $this->scheduled_date

Type

normal

$first_date

$first_date : \DateTime

The date & time the first instance of this schedule was setup to run (which may not be this instance).

Schedule objects are attached to an action object. Each schedule stores the run date for that object as the start date - @see $this->start - and logic to calculate the next run date after that - @see $this->calculate_next(). The $first_date property also keeps a record of when the very first instance of this chain of schedules ran.

Type

\DateTime

$scheduled_date

$scheduled_date : \DateTime

The date & time the schedule is set to run.

Type

\DateTime

$start_timestamp

$start_timestamp : null

Deprecated property @see $this->__wakeup() for details.

Type

normal

$interval_in_seconds

$interval_in_seconds : null

Deprecated property @see $this->__wakeup() for details.

Type

normal

Methods

__construct()

__construct(\DateTime  $date) : mixed

Construct.

Parameters

\DateTime $date

The date & time to run the action.

Returns

mixed

is_recurring()

is_recurring() : bool

Check if a schedule should recur.

Returns

bool

get_first_date()

get_first_date() : \DateTime|null

Get the date & time of the first schedule in this recurring series.

Returns

\DateTime|null

get_recurrence()

get_recurrence() : string

Get the schedule's recurrence.

Returns

string

__sleep()

__sleep() : array

Serialize interval schedules with data required prior to AS 3.0.0

Prior to Action Scheduler 3.0.0, recurring schedules used different property names to refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 aligned properties and property names for better inheritance. To guard against the possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to also store the data with the old property names so if it's unserialized in AS < 3.0, the schedule doesn't end up with a null/false/0 recurrence.

Returns

array

__wakeup()

__wakeup() : mixed

Unserialize interval schedules serialized/stored prior to AS 3.0.0

For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().

Returns

mixed

get_next()

get_next(\DateTime  $after) : \DateTime|null

Get the next date & time when this schedule should run after a given date & time.

Parameters

\DateTime $after

Start timestamp.

Returns

\DateTime|null

get_date()

get_date() : \DateTime|null

Get the date & time the schedule is set to run.

Returns

\DateTime|null

next()

next(\DateTime  $after = null) : \DateTime|null

Get the date & time this schedule was created to run, or calculate when it should be run after a given date & time.

Parameters

\DateTime $after

DateTime to calculate against.

Returns

\DateTime|null

interval_in_seconds()

interval_in_seconds() : int

Schedule interval in seconds.

Returns

int

calculate_next()

calculate_next(\DateTime  $after) : \DateTime

Calculate when this schedule should start after a given date & time using the number of seconds between recurrences.

Parameters

\DateTime $after

Timestamp.

Returns

\DateTime