Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98308644
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
Sat, Jan 11, 23:07
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 13, 23:07 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23540387
Attached To
rPH Phabricator
DrydockLeaseReleaseController.php
View Options
<?php
final
class
DrydockLeaseReleaseController
extends
DrydockController
{
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$lease
=
id
(
new
DrydockLease
())->
load
(
$this
->
id
);
if
(!
$lease
)
{
return
new
Aphront404Response
();
}
$lease_uri
=
'/lease/'
.
$lease
->
getID
().
'/'
;
$lease_uri
=
$this
->
getApplicationURI
(
$lease_uri
);
if
(
$lease
->
getStatus
()
!=
DrydockLeaseStatus
::
STATUS_ACTIVE
)
{
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$user
)
->
setTitle
(
pht
(
'Lease Not Active'
))
->
appendChild
(
phutil_tag
(
'p'
,
array
(),
pht
(
'You can only release "active" leases.'
)))
->
addCancelButton
(
$lease_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
if
(!
$request
->
isDialogFormPost
())
{
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$user
)
->
setTitle
(
pht
(
'Really release lease?'
))
->
appendChild
(
phutil_tag
(
'p'
,
array
(),
pht
(
'Releasing a lease may cause trouble for the lease holder and '
.
'trigger cleanup of the underlying resource. It can not be '
.
'undone. Continue?'
)))
->
addSubmitButton
(
pht
(
'Release Lease'
))
->
addCancelButton
(
$lease_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
$resource
=
$lease
->
loadResource
();
$blueprint
=
$resource
->
getBlueprint
();
$blueprint
->
releaseLease
(
$resource
,
$lease
);
return
id
(
new
AphrontReloadResponse
())->
setURI
(
$lease_uri
);
}
}
Event Timeline
Log In to Comment