Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F949431
PhabricatorFileDeleteController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorFileDeleteController.php
View Options
<?php
final
class
PhabricatorFileDeleteController
extends
PhabricatorFileController
{
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$file
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
$user
)
->
withIDs
(
array
(
$this
->
id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$file
)
{
return
new
Aphront404Response
();
}
if
((
$user
->
getPHID
()
!=
$file
->
getAuthorPHID
())
&&
(!
$user
->
getIsAdmin
()))
{
return
new
Aphront403Response
();
}
if
(
$request
->
isFormPost
())
{
$file
->
delete
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
'/file/'
);
}
$dialog
=
new
AphrontDialogView
();
$dialog
->
setUser
(
$user
);
$dialog
->
setTitle
(
pht
(
'Really delete file?'
));
$dialog
->
appendChild
(
hsprintf
(
'<p>%s</p>'
,
pht
(
"Permanently delete '%s'? This action can not be undone."
,
$file
->
getName
())));
$dialog
->
addSubmitButton
(
pht
(
'Delete'
));
$dialog
->
addCancelButton
(
$file
->
getInfoURI
());
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jun 17, 1:29 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
223773
Default Alt Text
PhabricatorFileDeleteController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment