| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/schedules.tar |
ActionScheduler_CanceledSchedule.php 0000666 00000003157 15115015410 0013567 0 ustar 00 <?php
/**
* Class ActionScheduler_SimpleSchedule
*/
class ActionScheduler_CanceledSchedule extends ActionScheduler_SimpleSchedule {
/**
* Deprecated property @see $this->__wakeup() for details.
*
* @var null
*/
private $timestamp = null;
/**
* Calculate when the next instance of this schedule would run based on a given date & time.
*
* @param DateTime $after Timestamp.
*
* @return DateTime|null
*/
public function calculate_next( DateTime $after ) {
return null;
}
/**
* Cancelled actions should never have a next schedule, even if get_next()
* is called with $after < $this->scheduled_date.
*
* @param DateTime $after Timestamp.
* @return DateTime|null
*/
public function get_next( DateTime $after ) {
return null;
}
/**
* Action is not recurring.
*
* @return bool
*/
public function is_recurring() {
return false;
}
/**
* 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. Action Scheduler 3.0.0
* aligned properties and property names for better inheritance. To maintain backward
* compatibility with schedules serialized and stored prior to 3.0, we need to correctly
* map the old property names with matching visibility.
*/
public function __wakeup() {
if ( ! is_null( $this->timestamp ) ) {
$this->scheduled_timestamp = $this->timestamp;
unset( $this->timestamp );
}
parent::__wakeup();
}
}
ActionScheduler_NullSchedule.php 0000666 00000001305 15115015410 0012774 0 ustar 00 <?php
/**
* Class ActionScheduler_NullSchedule
*/
class ActionScheduler_NullSchedule extends ActionScheduler_SimpleSchedule {
/**
* DateTime instance.
*
* @var DateTime|null
*/
protected $scheduled_date;
/**
* Make the $date param optional and default to null.
*
* @param null|DateTime $date The date & time to run the action.
*/
public function __construct( ?DateTime $date = null ) {
$this->scheduled_date = null;
}
/**
* This schedule has no scheduled DateTime, so we need to override the parent __sleep().
*
* @return array
*/
public function __sleep() {
return array();
}
/**
* Wakeup.
*/
public function __wakeup() {
$this->scheduled_date = null;
}
}
ActionScheduler_CronSchedule.php 0000666 00000007367 15115015410 0013001 0 ustar 00 <?php
/**
* Class ActionScheduler_CronSchedule
*/
class ActionScheduler_CronSchedule extends ActionScheduler_Abstract_RecurringSchedule implements ActionScheduler_Schedule {
/**
* Deprecated property @see $this->__wakeup() for details.
*
* @var null
*/
private $start_timestamp = null;
/**
* Deprecated property @see $this->__wakeup() for details.
*
* @var null
*/
private $cron = null;
/**
* Wrapper for parent constructor to accept a cron expression string and map it to a CronExpression for this
* objects $recurrence property.
*
* @param DateTime $start The date & time to run the action at or after. If $start aligns with the CronSchedule passed via $recurrence, it will be used. If it does not align, the first matching date after it will be used.
* @param CronExpression|string $recurrence The CronExpression used to calculate the schedule's next instance.
* @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance.
*/
public function __construct( DateTime $start, $recurrence, ?DateTime $first = null ) {
if ( ! is_a( $recurrence, 'CronExpression' ) ) {
$recurrence = CronExpression::factory( $recurrence );
}
// For backward compatibility, we need to make sure the date is set to the first matching cron date, not whatever date is passed in. Importantly, by passing true as the 3rd param, if $start matches the cron expression, then it will be used. This was previously handled in the now deprecated next() method.
$date = $recurrence->getNextRunDate( $start, 0, true );
// parent::__construct() will set this to $date by default, but that may be different to $start now.
$first = empty( $first ) ? $start : $first;
parent::__construct( $date, $recurrence, $first );
}
/**
* Calculate when an instance of this schedule would start based on a given
* date & time using its the CronExpression.
*
* @param DateTime $after Timestamp.
* @return DateTime
*/
protected function calculate_next( DateTime $after ) {
return $this->recurrence->getNextRunDate( $after, 0, false );
}
/**
* Get the schedule's recurrence.
*
* @return string
*/
public function get_recurrence() {
return strval( $this->recurrence );
}
/**
* Serialize cron 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 recurrence.
*
* @return array
*/
public function __sleep() {
$sleep_params = parent::__sleep();
$this->start_timestamp = $this->scheduled_timestamp;
$this->cron = $this->recurrence;
return array_merge(
$sleep_params,
array(
'start_timestamp',
'cron',
)
);
}
/**
* Unserialize cron schedules serialized/stored prior to AS 3.0.0
*
* For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().
*/
public function __wakeup() {
if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->start_timestamp ) ) {
$this->scheduled_timestamp = $this->start_timestamp;
unset( $this->start_timestamp );
}
if ( is_null( $this->recurrence ) && ! is_null( $this->cron ) ) {
$this->recurrence = $this->cron;
unset( $this->cron );
}
parent::__wakeup();
}
}
ActionScheduler_Schedule.php 0000666 00000000710 15115015410 0012140 0 ustar 00 <?php
/**
* Class ActionScheduler_Schedule
*/
interface ActionScheduler_Schedule {
/**
* Get the date & time this schedule was created to run, or calculate when it should be run
* after a given date & time.
*
* @param null|DateTime $after Timestamp.
* @return DateTime|null
*/
public function next( ?DateTime $after = null );
/**
* Identify the schedule as (not) recurring.
*
* @return bool
*/
public function is_recurring();
}
ActionScheduler_IntervalSchedule.php 0000666 00000005111 15115015410 0013645 0 ustar 00 <?php
/**
* Class ActionScheduler_IntervalSchedule
*/
class ActionScheduler_IntervalSchedule extends ActionScheduler_Abstract_RecurringSchedule implements ActionScheduler_Schedule {
/**
* Deprecated property @see $this->__wakeup() for details.
*
* @var null
*/
private $start_timestamp = null;
/**
* Deprecated property @see $this->__wakeup() for details.
*
* @var null
*/
private $interval_in_seconds = null;
/**
* Calculate when this schedule should start after a given date & time using
* the number of seconds between recurrences.
*
* @param DateTime $after Timestamp.
* @return DateTime
*/
protected function calculate_next( DateTime $after ) {
$after->modify( '+' . (int) $this->get_recurrence() . ' seconds' );
return $after;
}
/**
* Schedule interval in seconds.
*
* @return int
*/
public function interval_in_seconds() {
_deprecated_function( __METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()' );
return (int) $this->get_recurrence();
}
/**
* 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.
*
* @return array
*/
public function __sleep() {
$sleep_params = parent::__sleep();
$this->start_timestamp = $this->scheduled_timestamp;
$this->interval_in_seconds = $this->recurrence;
return array_merge(
$sleep_params,
array(
'start_timestamp',
'interval_in_seconds',
)
);
}
/**
* Unserialize interval schedules serialized/stored prior to AS 3.0.0
*
* For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup().
*/
public function __wakeup() {
if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->start_timestamp ) ) {
$this->scheduled_timestamp = $this->start_timestamp;
unset( $this->start_timestamp );
}
if ( is_null( $this->recurrence ) && ! is_null( $this->interval_in_seconds ) ) {
$this->recurrence = $this->interval_in_seconds;
unset( $this->interval_in_seconds );
}
parent::__wakeup();
}
}
ActionScheduler_SimpleSchedule.php 0000666 00000004477 15115015410 0013330 0 ustar 00 <?php
/**
* Class ActionScheduler_SimpleSchedule
*/
class ActionScheduler_SimpleSchedule extends ActionScheduler_Abstract_Schedule {
/**
* Deprecated property @see $this->__wakeup() for details.
*
* @var null|DateTime
*/
private $timestamp = null;
/**
* Calculate when this schedule should start after a given date & time using
* the number of seconds between recurrences.
*
* @param DateTime $after Timestamp.
*
* @return DateTime|null
*/
public function calculate_next( DateTime $after ) {
return null;
}
/**
* Schedule is not recurring.
*
* @return bool
*/
public function is_recurring() {
return false;
}
/**
* Serialize schedule with data required 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. Action Scheduler 3.0.0
* aligned properties and property names for better inheritance. To guard against the
* scheduled date for single actions always being seen as "now" 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 recurrence.
*
* @return array
*/
public function __sleep() {
$sleep_params = parent::__sleep();
$this->timestamp = $this->scheduled_timestamp;
return array_merge(
$sleep_params,
array(
'timestamp',
)
);
}
/**
* 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. Action Scheduler 3.0.0
* aligned properties and property names for better inheritance. To maintain backward
* compatibility with schedules serialized and stored prior to 3.0, we need to correctly
* map the old property names with matching visibility.
*/
public function __wakeup() {
if ( is_null( $this->scheduled_timestamp ) && ! is_null( $this->timestamp ) ) {
$this->scheduled_timestamp = $this->timestamp;
unset( $this->timestamp );
}
parent::__wakeup();
}
}