Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104122337
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
Thu, Mar 6, 14:35
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Mar 8, 14:35 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
24744651
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