Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / harbormaster / step / HarbormasterSleepBuildStepImplementation.php
blob60221b782ca3c772a6519543e0d008023c41996d
1 <?php
3 final class HarbormasterSleepBuildStepImplementation
4 extends HarbormasterBuildStepImplementation {
6 public function getName() {
7 return pht('Sleep');
10 public function getGenericDescription() {
11 return pht('Sleep for a specified number of seconds.');
15 public function getBuildStepGroupKey() {
16 return HarbormasterTestBuildStepGroup::GROUPKEY;
19 public function getDescription() {
20 return pht(
21 'Sleep for %s seconds.',
22 $this->formatSettingForDescription('seconds'));
25 public function execute(
26 HarbormasterBuild $build,
27 HarbormasterBuildTarget $build_target) {
29 $settings = $this->getSettings();
31 $target = time() + $settings['seconds'];
33 // Use $build_update so that we only reload every 5 seconds, but
34 // the sleep mechanism remains accurate.
35 $build_update = 5;
37 while (time() < $target) {
38 sleep(1);
40 if ($build_update <= 0) {
41 $build->reload();
42 $build_update = 5;
44 if ($this->shouldAbort($build, $build_target)) {
45 throw new HarbormasterBuildAbortedException();
47 } else {
48 $build_update -= 1;
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.'),