Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102248557
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
Tue, Feb 18, 17:56
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Feb 20, 17:56 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
24295458
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