Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F109845048
FileDeletionWorker.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
Wed, Apr 23, 15:14
Size
757 B
Mime Type
text/x-php
Expires
Fri, Apr 25, 15:14 (2 d)
Engine
blob
Format
Raw Data
Handle
25739892
Attached To
rPH Phabricator
FileDeletionWorker.php
View Options
<?php
final
class
FileDeletionWorker
extends
PhabricatorWorker
{
private
function
loadFile
()
{
$phid
=
idx
(
$this
->
getTaskData
(),
'objectPHID'
);
if
(!
$phid
)
{
throw
new
PhabricatorWorkerPermanentFailureException
(
pht
(
'No "%s" in task data.'
,
'objectPHID'
));
}
$file
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
PhabricatorUser
::
getOmnipotentUser
())
->
withPHIDs
(
array
(
$phid
))
->
executeOne
();
if
(!
$file
)
{
throw
new
PhabricatorWorkerPermanentFailureException
(
pht
(
'File "%s" does not exist.'
,
$phid
));
}
return
$file
;
}
protected
function
doWork
()
{
$file
=
$this
->
loadFile
();
$engine
=
new
PhabricatorDestructionEngine
();
$engine
->
destroyObject
(
$file
);
}
}
Event Timeline
Log In to Comment