When destroying an object, destroy its Herald transcripts too
Summary: Ref T5915. Make `bin/remove destroy` a bit more thorough, since Herald transcripts can have field information in them. Test Plan: Used `bin/remove destroy` to nuke revisions, saw their transcripts vanish too. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5915 Differential Revision: https://secure.phabricator.com/D10306
This commit is contained in:
@@ -3575,6 +3575,7 @@ phutil_register_library_map(array(
|
|||||||
'HeraldTranscript' => array(
|
'HeraldTranscript' => array(
|
||||||
'HeraldDAO',
|
'HeraldDAO',
|
||||||
'PhabricatorPolicyInterface',
|
'PhabricatorPolicyInterface',
|
||||||
|
'PhabricatorDestructibleInterface',
|
||||||
),
|
),
|
||||||
'HeraldTranscriptController' => 'HeraldController',
|
'HeraldTranscriptController' => 'HeraldController',
|
||||||
'HeraldTranscriptGarbageCollector' => 'PhabricatorGarbageCollector',
|
'HeraldTranscriptGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class HeraldTranscript extends HeraldDAO
|
final class HeraldTranscript extends HeraldDAO
|
||||||
implements PhabricatorPolicyInterface {
|
implements
|
||||||
|
PhabricatorPolicyInterface,
|
||||||
|
PhabricatorDestructibleInterface {
|
||||||
|
|
||||||
protected $objectTranscript;
|
protected $objectTranscript;
|
||||||
protected $ruleTranscripts = array();
|
protected $ruleTranscripts = array();
|
||||||
@@ -196,4 +198,16 @@ final class HeraldTranscript extends HeraldDAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function destroyObjectPermanently(
|
||||||
|
PhabricatorDestructionEngine $engine) {
|
||||||
|
|
||||||
|
$this->openTransaction();
|
||||||
|
$this->delete();
|
||||||
|
$this->saveTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,19 @@ final class PhabricatorDestructionEngine extends Phobject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nuke any Herald transcripts of the object, because they may contain
|
||||||
|
// field data.
|
||||||
|
|
||||||
|
// TODO: Define an interface so we don't have to do this for transactions
|
||||||
|
// and other objects with no Herald adapters?
|
||||||
|
$transcripts = id(new HeraldTranscript())->loadAllWhere(
|
||||||
|
'objectPHID = %s',
|
||||||
|
$object_phid);
|
||||||
|
foreach ($transcripts as $transcript) {
|
||||||
|
$transcript->destroyObjectPermanently($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Remove stuff from search indexes?
|
||||||
// TODO: PhabricatorFlaggableInterface
|
// TODO: PhabricatorFlaggableInterface
|
||||||
// TODO: PhabricatorTokenReceiverInterface
|
// TODO: PhabricatorTokenReceiverInterface
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user