mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Remove flags and tokens upon object destruction
Summary: When destroying an object, also remove all associated flags and tokens. Test Plan: Awarded a Maniphest task with a token and flagged it as well. Destroyed it with `./bin/remove destroy` and saw flag and token removed from the database. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D13112
This commit is contained in:
parent
55c73b20ca
commit
0b87e462cd
1 changed files with 25 additions and 3 deletions
|
@ -68,8 +68,30 @@ final class PhabricatorDestructionEngine extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove stuff from search indexes?
|
// TODO: Remove stuff from search indexes?
|
||||||
// TODO: PhabricatorFlaggableInterface
|
|
||||||
// TODO: PhabricatorTokenReceiverInterface
|
if ($object instanceof PhabricatorFlaggableInterface) {
|
||||||
|
$flags = id(new PhabricatorFlag())->loadAllWhere(
|
||||||
|
'objectPHID = %s', $object_phid);
|
||||||
|
|
||||||
|
foreach ($flags as $flag) {
|
||||||
|
$flag->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$flags = id(new PhabricatorFlag())->loadAllWhere(
|
||||||
|
'ownerPHID = %s', $object_phid);
|
||||||
|
foreach ($flags as $flag) {
|
||||||
|
$flag->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($object instanceof PhabricatorTokenReceiverInterface) {
|
||||||
|
$tokens = id(new PhabricatorTokenGiven())->loadAllWhere(
|
||||||
|
'objectPHID = %s', $object_phid);
|
||||||
|
|
||||||
|
foreach ($tokens as $token) {
|
||||||
|
$token->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function destroyEdges($src_phid) {
|
private function destroyEdges($src_phid) {
|
||||||
|
@ -116,7 +138,7 @@ final class PhabricatorDestructionEngine extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function destroyNotifications($object_phid) {
|
private function destroyNotifications($object_phid) {
|
||||||
$table = id(new PhabricatorFeedStoryNotification());
|
$table = new PhabricatorFeedStoryNotification();
|
||||||
$conn_w = $table->establishConnection('w');
|
$conn_w = $table->establishConnection('w');
|
||||||
|
|
||||||
queryfx(
|
queryfx(
|
||||||
|
|
Loading…
Reference in a new issue