Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F468441
HarbormasterSleepBuildStepImplementation.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
HarbormasterSleepBuildStepImplementation.php
View Options
<?php
final
class
HarbormasterSleepBuildStepImplementation
extends
HarbormasterBuildStepImplementation
{
public
function
getName
()
{
return
pht
(
'Sleep'
);
}
public
function
getGenericDescription
()
{
return
pht
(
'Sleep for a specified number of seconds.'
);
}
public
function
getBuildStepGroupKey
()
{
return
HarbormasterTestBuildStepGroup
::
GROUPKEY
;
}
public
function
getDescription
()
{
return
pht
(
'Sleep for %s seconds.'
,
$this
->
formatSettingForDescription
(
'seconds'
));
}
public
function
execute
(
HarbormasterBuild
$build
,
HarbormasterBuildTarget
$build_target
)
{
$settings
=
$this
->
getSettings
();
$target
=
time
()
+
$settings
[
'seconds'
];
// Use $build_update so that we only reload every 5 seconds, but
// the sleep mechanism remains accurate.
$build_update
=
5
;
while
(
time
()
<
$target
)
{
sleep
(
1
);
if
(
$build_update
<=
0
)
{
$build
->
reload
();
$build_update
=
5
;
if
(
$this
->
shouldAbort
(
$build
,
$build_target
))
{
throw
new
HarbormasterBuildAbortedException
();
}
}
else
{
$build_update
-=
1
;
}
}
}
public
function
getFieldSpecifications
()
{
return
array
(
'seconds'
=>
array
(
'name'
=>
pht
(
'Seconds'
),
'type'
=>
'int'
,
'required'
=>
true
,
'caption'
=>
pht
(
'The number of seconds to sleep for.'
),
),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 6, 5:21 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
80550
Default Alt Text
HarbormasterSleepBuildStepImplementation.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment