Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91848888
PhrictionDeleteController.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, Nov 15, 03:00
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 17, 03:00 (2 d)
Engine
blob
Format
Raw Data
Handle
22333811
Attached To
rPH Phabricator
PhrictionDeleteController.php
View Options
<?php
/**
* @group phriction
*/
final
class
PhrictionDeleteController
extends
PhrictionController
{
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$document
=
id
(
new
PhrictionDocument
())->
load
(
$this
->
id
);
if
(!
$document
)
{
return
new
Aphront404Response
();
}
$document_uri
=
PhrictionDocument
::
getSlugURI
(
$document
->
getSlug
());
if
(
$request
->
isFormPost
())
{
$editor
=
id
(
PhrictionDocumentEditor
::
newForSlug
(
$document
->
getSlug
()))
->
setActor
(
$user
)
->
delete
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$document_uri
);
}
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$user
)
->
setTitle
(
pht
(
'Delete document?'
))
->
appendChild
(
pht
(
'Really delete this document? You can recover it later by '
.
'reverting to a previous version.'
))
->
addSubmitButton
(
pht
(
'Delete'
))
->
addCancelButton
(
$document_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment