Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96400659
HarbormasterBuildCancelController.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, Dec 26, 10:32
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Dec 28, 10:32 (2 d)
Engine
blob
Format
Raw Data
Handle
23163907
Attached To
rPH Phabricator
HarbormasterBuildCancelController.php
View Options
<?php
final
class
HarbormasterBuildCancelController
extends
HarbormasterController
{
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$id
=
$this
->
id
;
$build
=
id
(
new
HarbormasterBuildQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
executeOne
();
if
(
$build
===
null
)
{
return
new
Aphront404Response
();
}
$build_uri
=
$this
->
getApplicationURI
(
'/build/'
.
$build
->
getID
());
if
(
$request
->
isDialogFormPost
())
{
$build
->
setCancelRequested
(
1
);
$build
->
save
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$build_uri
);
}
$dialog
=
new
AphrontDialogView
();
$dialog
->
setTitle
(
pht
(
'Really cancel build?'
))
->
setUser
(
$viewer
)
->
addSubmitButton
(
pht
(
'Cancel'
))
->
addCancelButton
(
$build_uri
,
pht
(
'Don
\'
t Cancel'
));
$dialog
->
appendChild
(
phutil_tag
(
'p'
,
array
(),
pht
(
'Really cancel this build?'
)));
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment