Page MenuHomeMTRNord's Forge
Diviner Tech Docs PhabricatorBeforeDestructionEngineExtension

abstract class PhabricatorBeforeDestructionEngineExtension
Phorge Technical Documentation (System)

Abstract "Before Destruction Engine", to fire a hook before something is permamently destroyed.

This class is to be considered unstable and may receive variations over time. If you want to use this engine or extend its features, please share your use-case here, even if the task is closed: https://we.phorge.it/T16079

Methods

final public function getExtensionKey()

Get the extension internal key.

Return
string

abstract public function getExtensionName()

Get the extension human name.

Return
string

public function canBeforeDestroyObject($destruction_engine, $object)

Check if this extension supports a "Before Destruction" hook on the specified object.

The object is guaranteed to have a PHID and still exist but will be destroyed later. This method should not contain write operations. This method exposes a PhabricatorDestructionEngine since it can give useful info, but here you should not use it to destroy objects. When this method returns true, the method beforeDestroyObject() will be fired.

Parameters
PhabricatorDestructionEngine$destruction_engineAvailable destruction engine
object$objectObject that will be destroyed
Return
boolIf true, beforeDestroyObject() will be fired.

abstract public function beforeDestroyObject($destruction_engine, $object)

Call your "Before Destruction" hook on the specified object. The object is guaranteed to have a PHID and still exist but will be destroyed later. This method is not called if canBeforeDestroyObject() returns false.

Parameters
PhabricatorDestructionEngine$destruction_engineAvailable destruction engine
object$objectObject that will be destroyed
Return
wild

final public static function getAllExtensions()

Get all "Before Destruction Engine" extensions.

Return
list<PhabricatorDestructionEngineExtension>