Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F114950746
DrydockLeaseReleaseController.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
Wed, May 28, 21:43
Size
1 KB
Mime Type
text/x-php
Expires
Fri, May 30, 21:43 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
26448758
Attached To
rPH Phabricator
DrydockLeaseReleaseController.php
View Options
<?php
final
class
DrydockLeaseReleaseController
extends
DrydockLeaseController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$lease
=
id
(
new
DrydockLeaseQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$lease
)
{
return
new
Aphront404Response
();
}
$lease_uri
=
'/lease/'
.
$lease
->
getID
().
'/'
;
$lease_uri
=
$this
->
getApplicationURI
(
$lease_uri
);
if
(!
$lease
->
canRelease
())
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Lease Not Releasable'
))
->
appendParagraph
(
pht
(
'Leases can not be released after they are destroyed.'
))
->
addCancelButton
(
$lease_uri
);
}
if
(
$request
->
isFormPost
())
{
$command
=
DrydockCommand
::
initializeNewCommand
(
$viewer
)
->
setTargetPHID
(
$lease
->
getPHID
())
->
setCommand
(
DrydockCommand
::
COMMAND_RELEASE
)
->
save
();
$lease
->
scheduleUpdate
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$lease_uri
);
}
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Release Lease?'
))
->
appendParagraph
(
pht
(
'Forcefully releasing a lease may interfere with the operation '
.
'of the lease holder and trigger destruction of the underlying '
.
'resource. It can not be undone.'
))
->
addSubmitButton
(
pht
(
'Release Lease'
))
->
addCancelButton
(
$lease_uri
);
}
}
Event Timeline
Log In to Comment