Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96107681
PhagePlanAction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 22, 16:17
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 16:17 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23105325
Attached To
rPHU libphutil
PhagePlanAction.php
View Options
<?php
final
class
PhagePlanAction
extends
PhageAction
{
public
function
isContainerAction
()
{
return
true
;
}
protected
function
willAddAction
(
PhageAction
$action
)
{
if
(!(
$action
instanceof
PhageAgentAction
))
{
throw
new
Exception
(
pht
(
'Only agent actions may be added to a plan.'
));
}
}
public
function
executePlan
()
{
$agents
=
$this
->
getAgents
();
foreach
(
$agents
as
$agent
)
{
$agent
->
startAgent
();
}
while
(
true
)
{
$channels
=
$this
->
getAllWaitingChannels
();
PhutilChannel
::
waitForAny
(
$channels
);
$agents
=
$this
->
getActiveAgents
();
if
(!
$agents
)
{
break
;
}
foreach
(
$agents
as
$agent
)
{
$agent
->
updateAgent
();
}
}
}
protected
function
getAgents
()
{
return
$this
->
getActions
();
}
protected
function
getActiveAgents
()
{
$agents
=
$this
->
getAgents
();
foreach
(
$agents
as
$key
=>
$agent
)
{
if
(!
$agent
->
isActiveAgent
())
{
unset
(
$agents
[
$key
]);
}
}
return
$agents
;
}
}
Event Timeline
Log In to Comment