\ActionScheduler_Abstract_RecurringSchedule

Class ActionScheduler_Abstract_RecurringSchedule

Summary

Methods
Properties
Constants
__construct()
is_recurring()
get_next()
get_date()
__sleep()
__wakeup()
next()
get_first_date()
get_recurrence()
No public properties found
No constants found
calculate_next()
$scheduled_timestamp
$first_timestamp
$recurrence
N/A
No private methods found
$scheduled_date
$first_date
N/A

Properties

$scheduled_timestamp

$scheduled_timestamp : int

Timestamp equivalent of @see $this->scheduled_date

Type

normal

$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_date

$scheduled_date : \DateTime

The date & time the schedule is set to run.

Type

\DateTime

$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

Methods

__construct()

__construct(\DateTime  $date, mixed  $recurrence, \DateTime|null  $first = null) : mixed

Construct.

Parameters

\DateTime $date

The date & time to run the action.

mixed $recurrence

The data used to determine the schedule's recurrence.

\DateTime|null $first

(Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance.

Returns

mixed

is_recurring()

is_recurring() : bool

Schedule is recurring.

Returns

bool

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

__sleep()

__sleep() : array

For PHP 5.2 compat, since DateTime objects can't be serialized

Returns

array

__wakeup()

__wakeup() : mixed

Unserialize recurring schedules serialized/stored prior to AS 3.0.0

Prior to Action Scheduler 3.0.0, schedules used different property names to refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp was the same as ActionScheduler_SimpleSchedule::timestamp. This was addressed in Action Scheduler 3.0.0, where properties and property names were aligned for better inheritance. To maintain backward compatibility with scheduled serialized and stored prior to 3.0, we need to correctly map the old property names.

Returns

mixed

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

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

calculate_next()

calculate_next(\DateTime  $after) : \DateTime

Calculate when the next instance of this schedule would run based on a given date & time.

Parameters

\DateTime $after

Start timestamp.

Returns

\DateTime