Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106002867
DrydockManagementUpdateLeaseWorkflow.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
Fri, Mar 21, 10:19
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Mar 23, 10:19 (2 d)
Engine
blob
Format
Raw Data
Handle
25058088
Attached To
rPH Phabricator
DrydockManagementUpdateLeaseWorkflow.php
View Options
<?php
final
class
DrydockManagementUpdateLeaseWorkflow
extends
DrydockManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'update-lease'
)
->
setSynopsis
(
pht
(
'Update a lease.'
))
->
setArguments
(
array
(
array
(
'name'
=>
'id'
,
'param'
=>
'id'
,
'repeat'
=>
true
,
'help'
=>
pht
(
'Lease 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 lease IDs to update with "%s".'
,
'--id'
));
}
$leases
=
id
(
new
DrydockLeaseQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
$ids
)
->
execute
();
PhabricatorWorker
::
setRunAllTasksInProcess
(
true
);
foreach
(
$ids
as
$id
)
{
$lease
=
idx
(
$leases
,
$id
);
if
(!
$lease
)
{
echo
tsprintf
(
"%s
\n
"
,
pht
(
'Lease "%s" does not exist.'
,
$id
));
continue
;
}
echo
tsprintf
(
"%s
\n
"
,
pht
(
'Updating lease "%s".'
,
$id
));
$lease
->
scheduleUpdate
();
}
}
}
Event Timeline
Log In to Comment