Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72118566
PhabricatorDestructionEngine.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
Sun, Jul 14, 19:47
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jul 16, 19:47 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19035679
Attached To
rPH Phabricator
PhabricatorDestructionEngine.php
View Options
<?php
final
class
PhabricatorDestructionEngine
extends
Phobject
{
private
$rootLogID
;
public
function
getViewer
()
{
return
PhabricatorUser
::
getOmnipotentUser
();
}
public
function
destroyObject
(
PhabricatorDestructibleInterface
$object
)
{
$log
=
id
(
new
PhabricatorSystemDestructionLog
())
->
setEpoch
(
time
())
->
setObjectClass
(
get_class
(
$object
));
if
(
$this
->
rootLogID
)
{
$log
->
setRootLogID
(
$this
->
rootLogID
);
}
$object_phid
=
$this
->
getObjectPHID
(
$object
);
if
(
$object_phid
)
{
$log
->
setObjectPHID
(
$object_phid
);
}
if
(
method_exists
(
$object
,
'getMonogram'
))
{
try
{
$log
->
setObjectMonogram
(
$object
->
getMonogram
());
}
catch
(
Exception
$ex
)
{
// Ignore.
}
}
$log
->
save
();
if
(!
$this
->
rootLogID
)
{
$this
->
rootLogID
=
$log
->
getID
();
}
$object
->
destroyObjectPermanently
(
$this
);
if
(
$object_phid
)
{
$extensions
=
PhabricatorDestructionEngineExtension
::
getAllExtensions
();
foreach
(
$extensions
as
$key
=>
$extension
)
{
if
(!
$extension
->
canDestroyObject
(
$this
,
$object
))
{
unset
(
$extensions
[
$key
]);
continue
;
}
}
foreach
(
$extensions
as
$key
=>
$extension
)
{
$extension
->
destroyObject
(
$this
,
$object
);
}
}
}
private
function
getObjectPHID
(
$object
)
{
if
(!
is_object
(
$object
))
{
return
null
;
}
if
(!
method_exists
(
$object
,
'getPHID'
))
{
return
null
;
}
try
{
return
$object
->
getPHID
();
}
catch
(
Exception
$ex
)
{
return
null
;
}
}
}
Event Timeline
Log In to Comment