Page MenuHomec4science

PhabricatorTokenDestructionEngineExtension.php
No OneTemporary

File Metadata

Created
Sat, Nov 23, 01:36

PhabricatorTokenDestructionEngineExtension.php

<?php
final class PhabricatorTokenDestructionEngineExtension
extends PhabricatorDestructionEngineExtension {
const EXTENSIONKEY = 'tokens';
public function getExtensionName() {
return pht('Tokens');
}
public function canDestroyObject(
PhabricatorDestructionEngine $engine,
$object) {
return ($object instanceof PhabricatorTokenReceiverInterface);
}
public function destroyObject(
PhabricatorDestructionEngine $engine,
$object) {
$tokens = id(new PhabricatorTokenGiven())->loadAllWhere(
'objectPHID = %s',
$object->getPHID());
foreach ($tokens as $token) {
$token->delete();
}
}
}

Event Timeline