From 1a84a2fe4bc485fb7aa6e03241684bc506ccb191 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Sun, 15 Nov 2015 20:58:50 +0000 Subject: [PATCH] Permanently destroy Almanac properties with the destruction engine Summary: As suggested in D14461. Test Plan: Used `./bin/remove destroy` on an Almanac service with properties attached, saw entries removed from the `phabricator_almanac.almanac_property` table. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D14490 --- .../engine/PhabricatorDestructionEngine.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/applications/system/engine/PhabricatorDestructionEngine.php b/src/applications/system/engine/PhabricatorDestructionEngine.php index fd7ba7c30a..607c526c14 100644 --- a/src/applications/system/engine/PhabricatorDestructionEngine.php +++ b/src/applications/system/engine/PhabricatorDestructionEngine.php @@ -92,6 +92,10 @@ final class PhabricatorDestructionEngine extends Phobject { $token->delete(); } } + + if ($object instanceof AlmanacPropertyInterface) { + $this->destroyAlmanacProperties($object_phid); + } } private function destroyEdges($src_phid) { @@ -148,4 +152,15 @@ final class PhabricatorDestructionEngine extends Phobject { $object_phid); } + private function destroyAlmanacProperties($object_phid) { + $table = new AlmanacProperty(); + $conn_w = $table->establishConnection('w'); + + queryfx( + $conn_w, + 'DELETE FROM %T WHERE objectPHID = %s', + $table->getTableName(), + $object_phid); + } + }