Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103850383
DrydockResourceDestroyWorker.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, Mar 5, 02:35
Size
948 B
Mime Type
text/x-php
Expires
Fri, Mar 7, 02:35 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
24677852
Attached To
rPH Phabricator
DrydockResourceDestroyWorker.php
View Options
<?php
final
class
DrydockResourceDestroyWorker
extends
DrydockWorker
{
protected
function
doWork
()
{
$resource_phid
=
$this
->
getTaskDataValue
(
'resourcePHID'
);
$resource
=
$this
->
loadResource
(
$resource_phid
);
$this
->
destroyResource
(
$resource
);
}
private
function
destroyResource
(
DrydockResource
$resource
)
{
$status
=
$resource
->
getStatus
();
switch
(
$status
)
{
case
DrydockResourceStatus
::
STATUS_CLOSED
:
case
DrydockResourceStatus
::
STATUS_BROKEN
:
break
;
default
:
throw
new
PhabricatorWorkerPermanentFailureException
(
pht
(
'Unable to destroy resource ("%s"), resource has the wrong '
.
'status ("%s").'
,
$resource
->
getPHID
(),
$status
));
}
$blueprint
=
$resource
->
getBlueprint
();
$blueprint
->
destroyResource
(
$resource
);
$resource
->
setStatus
(
DrydockResourceStatus
::
STATUS_DESTROYED
)
->
save
();
}
}
Event Timeline
Log In to Comment