From cccdc488834ad2a8de052c51a1fda65e25bf40fb Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 19 Jan 2015 16:55:38 -0800 Subject: [PATCH] Implement PhabricatorDestructibleInterface for event triggers Summary: Ref T6881. When stuff with triggers is destroyed, it should destroy the triggers. Test Plan: Will test in Instances. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T6881 Differential Revision: https://secure.phabricator.com/D11435 --- src/__phutil_library_map__.php | 5 ++++- .../storage/PhabricatorWorkerTrigger.php | 22 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 076be4b597..f31547cd97 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -5884,7 +5884,10 @@ phutil_register_library_map(array( 'PhabricatorWorkerTaskData' => 'PhabricatorWorkerDAO', 'PhabricatorWorkerTaskDetailController' => 'PhabricatorDaemonController', 'PhabricatorWorkerTestCase' => 'PhabricatorTestCase', - 'PhabricatorWorkerTrigger' => 'PhabricatorWorkerDAO', + 'PhabricatorWorkerTrigger' => array( + 'PhabricatorWorkerDAO', + 'PhabricatorDestructibleInterface', + ), 'PhabricatorWorkerTriggerEvent' => 'PhabricatorWorkerDAO', 'PhabricatorWorkerTriggerPHIDType' => 'PhabricatorPHIDType', 'PhabricatorWorkerTriggerQuery' => 'PhabricatorOffsetPagedQuery', diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php index 8931b6ffdb..0fe4943237 100644 --- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php +++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php @@ -1,7 +1,9 @@ openTransaction(); + queryfx( + $this->establishConnection('w'), + 'DELETE FROM %T WHERE triggerID = %d', + id(new PhabricatorWorkerTriggerEvent())->getTableName(), + $this->getID()); + + $this->delete(); + $this->saveTransaction(); + } + }