@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a call to predict the next event for a trigger

Summary: Ref T6881. This is useful to show a "Next backup: 2:30 AM" sort of thing without requring callers to know how triggers work internally.

Test Plan: Showed that kind of thing in Instances.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6881

Differential Revision: https://secure.phabricator.com/D11437

+20
+20
src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php
··· 130 130 } 131 131 132 132 133 + /** 134 + * Predict the epoch at which this trigger will next fire. 135 + * 136 + * @return int|null Epoch when the event will next fire, or `null` if it is 137 + * not planned to trigger. 138 + */ 139 + public function getNextEventPrediction() { 140 + // NOTE: We're basically echoing the database state here, so this won't 141 + // necessarily be accurate if the caller just updated the object but has 142 + // not saved it yet. That's a weird use case and would require more 143 + // gymnastics, so don't bother trying to get it totally correct for now. 144 + 145 + if ($this->getEvent()) { 146 + return $this->getEvent()->getNextEpoch(); 147 + } else { 148 + return $this->getNextEventEpoch(null, $is_reschedule = false); 149 + } 150 + } 151 + 152 + 133 153 /* -( PhabricatorDestructibleInterface )----------------------------------- */ 134 154 135 155