Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F559085
DrydockManagementUpdateResourceWorkflow.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
DrydockManagementUpdateResourceWorkflow.php
View Options
<?php
final
class
DrydockManagementUpdateResourceWorkflow
extends
DrydockManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'update-resource'
)
->
setSynopsis
(
pht
(
'Update a resource.'
))
->
setArguments
(
array
(
array
(
'name'
=>
'id'
,
'param'
=>
'id'
,
'repeat'
=>
true
,
'help'
=>
pht
(
'Resource ID to update.'
),
),
));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$viewer
=
$this
->
getViewer
();
$ids
=
$args
->
getArg
(
'id'
);
if
(!
$ids
)
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Specify one or more resource IDs to update with "%s".'
,
'--id'
));
}
$resources
=
id
(
new
DrydockResourceQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
$ids
)
->
execute
();
PhabricatorWorker
::
setRunAllTasksInProcess
(
true
);
foreach
(
$ids
as
$id
)
{
$resource
=
idx
(
$resources
,
$id
);
if
(!
$resource
)
{
echo
tsprintf
(
"%s
\n
"
,
pht
(
'Resource "%s" does not exist.'
,
$id
));
continue
;
}
echo
tsprintf
(
"%s
\n
"
,
pht
(
'Updating resource "%s".'
,
$id
));
$resource
->
scheduleUpdate
();
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 10:12 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
101611
Default Alt Text
DrydockManagementUpdateResourceWorkflow.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment