Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F464919
DrydockManagementCloseWorkflow.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
DrydockManagementCloseWorkflow.php
View Options
<?php
final
class
DrydockManagementCloseWorkflow
extends
DrydockManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'close'
)
->
setSynopsis
(
pht
(
'Close a resource.'
))
->
setArguments
(
array
(
array
(
'name'
=>
'ids'
,
'wildcard'
=>
true
,
),
));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$console
=
PhutilConsole
::
getConsole
();
$ids
=
$args
->
getArg
(
'ids'
);
if
(!
$ids
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Specify one or more resource IDs to close.'
));
}
$viewer
=
$this
->
getViewer
();
$resources
=
id
(
new
DrydockResourceQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
$ids
)
->
execute
();
foreach
(
$ids
as
$id
)
{
$resource
=
idx
(
$resources
,
$id
);
if
(!
$resource
)
{
$console
->
writeErr
(
"%s
\n
"
,
pht
(
'Resource %d does not exist!'
,
$id
));
}
else
if
(
$resource
->
getStatus
()
!=
DrydockResourceStatus
::
STATUS_OPEN
)
{
$console
->
writeErr
(
"%s
\n
"
,
pht
(
"Resource %d is not 'open'!"
,
$id
));
}
else
{
$resource
->
closeResource
();
$console
->
writeErr
(
"%s
\n
"
,
pht
(
'Closed resource %d.'
,
$id
));
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 10:07 PM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
78285
Default Alt Text
DrydockManagementCloseWorkflow.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment