@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.

at recaptime-dev/main 64 lines 1.4 kB view raw
1<?php 2 3final class HarbormasterSleepBuildStepImplementation 4 extends HarbormasterBuildStepImplementation { 5 6 public function getName() { 7 return pht('Sleep'); 8 } 9 10 public function getGenericDescription() { 11 return pht('Sleep for a specified number of seconds.'); 12 } 13 14 15 public function getBuildStepGroupKey() { 16 return HarbormasterTestBuildStepGroup::GROUPKEY; 17 } 18 19 public function getDescription() { 20 return pht( 21 'Sleep for %s seconds.', 22 $this->formatSettingForDescription('seconds')); 23 } 24 25 public function execute( 26 HarbormasterBuild $build, 27 HarbormasterBuildTarget $build_target) { 28 29 $settings = $this->getSettings(); 30 31 $target = time() + $settings['seconds']; 32 33 // Use $build_update so that we only reload every 5 seconds, but 34 // the sleep mechanism remains accurate. 35 $build_update = 5; 36 37 while (time() < $target) { 38 sleep(1); 39 40 if ($build_update <= 0) { 41 $build->reload(); 42 $build_update = 5; 43 44 if ($this->shouldAbort($build, $build_target)) { 45 throw new HarbormasterBuildAbortedException(); 46 } 47 } else { 48 $build_update -= 1; 49 } 50 } 51 } 52 53 public function getFieldSpecifications() { 54 return array( 55 'seconds' => array( 56 'name' => pht('Seconds'), 57 'type' => 'int', 58 'required' => true, 59 'caption' => pht('The number of seconds to sleep for.'), 60 ), 61 ); 62 } 63 64}