Page MenuHomePhorge
Diviner Tech Docs PhabricatorDailyRoutineTriggerClock

final class PhabricatorDailyRoutineTriggerClock
Phorge Technical Documentation (Daemons)

Triggers a daily routine, like server backups.

This clock triggers events every 24 hours, using UTC. It does not use a locale, and is intended for technical processes like backing up a server every night.

Because UTC does not have daylight savings, the local hour when this event occurs will change over the course of the year. For example, from the perspective of a user in California, it might run backups at 3AM in the winter and 2AM in the summer. This is desirable for maintenance processes, but problematic for some human processes. Use a different clock if you're triggering a human-oriented event.

The clock uses the time of day of the start epoch to calculate the time of day of the next event, so you can change the time of day when the event occurs by adjusting the start time of day.

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function __construct($properties)
Inherited

This method is not documented.
Parameters
array$properties
Return
this//Implicit.//

public function getProperties()
Inherited

This method is not documented.
Return
wild

public function getProperty($key, $default)
Inherited

This method is not documented.
Parameters
$key
$default
Return
wild

public function validateProperties($properties)

PhabricatorTriggerClock

Validate clock configuration.

PhabricatorDailyRoutineTriggerClock
This method is not documented.
Parameters
map<string,$propertieswild> Map of clock properties.
Return
void

public function getNextEventEpoch($last_epoch, $is_reschedule)

PhabricatorTriggerClock

Get the next occurrence of this event.

This method takes two parameters: the last time this event occurred (or null if it has never triggered before) and a flag distinguishing between a normal reschedule (after a successful trigger) or an update because of a trigger change.

If this event does not occur again, return null to stop it from being rescheduled. For example, a meeting reminder may be sent only once before the meeting.

If this event does occur again, return the epoch timestamp of the next occurrence.

When performing routine reschedules, the event must move forward in time: any timestamp you return must be later than the last event. For instance, if this event triggers an invoice, the next invoice date must be after the previous invoice date. This prevents an event from looping more than once per second.

In contrast, after an update (not a routine reschedule), the next event may be scheduled at any time. For example, if a meeting is moved from next week to 3 minutes from now, the clock may reschedule the notification to occur 12 minutes ago. This will cause it to execute immediately.

PhabricatorDailyRoutineTriggerClock
This method is not documented.
Parameters
int|null$last_epochLast time the event occurred, or null if it has never triggered before.
bool$is_rescheduleTrue if this is a reschedule after a successful trigger.
Return
int|nullNext event, or null to decline to reschedule.