Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98281593
DrydockManagementUpdateResourceWorkflow.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
Sat, Jan 11, 18:08
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 13, 18:08 (2 d)
Engine
blob
Format
Raw Data
Handle
23548183
Attached To
rPH Phabricator
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
();
}
}
}
Event Timeline
Log In to Comment