Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15408712
D19269.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D19269.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -6525,6 +6525,7 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorConduitResultInterface',
+ 'PhabricatorDestructibleInterface',
),
'HarbormasterBuildAbortedException' => 'Exception',
'HarbormasterBuildActionController' => 'HarbormasterController',
@@ -6532,6 +6533,7 @@
'HarbormasterBuildArtifact' => array(
'HarbormasterDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorDestructibleInterface',
),
'HarbormasterBuildArtifactPHIDType' => 'PhabricatorPHIDType',
'HarbormasterBuildArtifactQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@@ -6564,6 +6566,7 @@
'HarbormasterBuildMessage' => array(
'HarbormasterDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorDestructibleInterface',
),
'HarbormasterBuildMessageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'HarbormasterBuildPHIDType' => 'PhabricatorPHIDType',
@@ -6614,6 +6617,7 @@
'HarbormasterBuildTarget' => array(
'HarbormasterDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorDestructibleInterface',
),
'HarbormasterBuildTargetPHIDType' => 'PhabricatorPHIDType',
'HarbormasterBuildTargetQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@@ -6628,6 +6632,7 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'HarbormasterBuildableInterface',
+ 'PhabricatorDestructibleInterface',
),
'HarbormasterBuildableActionController' => 'HarbormasterController',
'HarbormasterBuildableListController' => 'HarbormasterController',
diff --git a/src/applications/harbormaster/storage/HarbormasterBuildMessage.php b/src/applications/harbormaster/storage/HarbormasterBuildMessage.php
--- a/src/applications/harbormaster/storage/HarbormasterBuildMessage.php
+++ b/src/applications/harbormaster/storage/HarbormasterBuildMessage.php
@@ -6,8 +6,11 @@
* conditions where we receive a message before a build plan is ready to
* accept it.
*/
-final class HarbormasterBuildMessage extends HarbormasterDAO
- implements PhabricatorPolicyInterface {
+final class HarbormasterBuildMessage
+ extends HarbormasterDAO
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorDestructibleInterface {
protected $authorPHID;
protected $receiverPHID;
@@ -74,4 +77,13 @@
return pht('Build messages have the same policies as their receivers.');
}
+
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+ $this->delete();
+ }
+
}
diff --git a/src/applications/harbormaster/storage/HarbormasterBuildable.php b/src/applications/harbormaster/storage/HarbormasterBuildable.php
--- a/src/applications/harbormaster/storage/HarbormasterBuildable.php
+++ b/src/applications/harbormaster/storage/HarbormasterBuildable.php
@@ -1,10 +1,12 @@
<?php
-final class HarbormasterBuildable extends HarbormasterDAO
+final class HarbormasterBuildable
+ extends HarbormasterDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
- HarbormasterBuildableInterface {
+ HarbormasterBuildableInterface,
+ PhabricatorDestructibleInterface {
protected $buildablePHID;
protected $containerPHID;
@@ -340,4 +342,32 @@
}
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+ $viewer = $engine->getViewer();
+
+ $this->openTransaction();
+ $builds = id(new HarbormasterBuildQuery())
+ ->setViewer($viewer)
+ ->withBuildablePHIDs(array($this->getPHID()))
+ ->execute();
+ foreach ($builds as $build) {
+ $engine->destroyObject($build);
+ }
+
+ $messages = id(new HarbormasterBuildMessageQuery())
+ ->setViewer($viewer)
+ ->withReceiverPHIDs(array($this->getPHID()))
+ ->execute();
+ foreach ($messages as $message) {
+ $engine->destroyObject($message);
+ }
+
+ $this->delete();
+ $this->saveTransaction();
+ }
+
}
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuild.php b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
@@ -4,7 +4,8 @@
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
- PhabricatorConduitResultInterface {
+ PhabricatorConduitResultInterface,
+ PhabricatorDestructibleInterface {
protected $buildablePHID;
protected $buildPlanPHID;
@@ -455,4 +456,33 @@
);
}
+
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+ $viewer = $engine->getViewer();
+
+ $this->openTransaction();
+ $targets = id(new HarbormasterBuildTargetQuery())
+ ->setViewer($viewer)
+ ->withBuildPHIDs(array($this->getPHID()))
+ ->execute();
+ foreach ($targets as $target) {
+ $engine->destroyObject($target);
+ }
+
+ $messages = id(new HarbormasterBuildMessageQuery())
+ ->setViewer($viewer)
+ ->withReceiverPHIDs(array($this->getPHID()))
+ ->execute();
+ foreach ($messages as $message) {
+ $engine->destroyObject($message);
+ }
+
+ $this->delete();
+ $this->saveTransaction();
+ }
+
+
}
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php b/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
@@ -1,7 +1,10 @@
<?php
-final class HarbormasterBuildArtifact extends HarbormasterDAO
- implements PhabricatorPolicyInterface {
+final class HarbormasterBuildArtifact
+ extends HarbormasterDAO
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorDestructibleInterface {
protected $buildTargetPHID;
protected $artifactType;
@@ -147,4 +150,19 @@
return pht('Users must be able to see a buildable to see its artifacts.');
}
+
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+
+ $viewer = $this->getViewer();
+
+ $this->openTransaction();
+ $this->releaseArtifact($viewer);
+ $this->delete();
+ $this->saveTransaction();
+ }
+
}
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php b/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
@@ -1,7 +1,10 @@
<?php
-final class HarbormasterBuildTarget extends HarbormasterDAO
- implements PhabricatorPolicyInterface {
+final class HarbormasterBuildTarget
+ extends HarbormasterDAO
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorDestructibleInterface {
protected $name;
protected $buildPHID;
@@ -354,4 +357,59 @@
return pht('Users must be able to see a build to view its build targets.');
}
+
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+ $viewer = $engine->getViewer();
+
+ $this->openTransaction();
+
+ $lint_message = new HarbormasterBuildLintMessage();
+ $conn = $lint_message->establishConnection('w');
+ queryfx(
+ $conn,
+ 'DELETE FROM %T WHERE buildTargetPHID = %s',
+ $lint_message->getTableName(),
+ $this->getPHID());
+
+ $unit_message = new HarbormasterBuildUnitMessage();
+ $conn = $unit_message->establishConnection('w');
+ queryfx(
+ $conn,
+ 'DELETE FROM %T WHERE buildTargetPHID = %s',
+ $unit_message->getTableName(),
+ $this->getPHID());
+
+ $logs = id(new HarbormasterBuildLogQuery())
+ ->setViewer($viewer)
+ ->withBuildTargetPHIDs(array($this->getPHID()))
+ ->execute();
+ foreach ($logs as $log) {
+ $engine->destroyObject($log);
+ }
+
+ $artifacts = id(new HarbormasterBuildArtifactQuery())
+ ->setViewer($viewer)
+ ->withBuildTargetPHIDs(array($this->getPHID()))
+ ->execute();
+ foreach ($artifacts as $artifact) {
+ $engine->destroyObject($artifact);
+ }
+
+ $messages = id(new HarbormasterBuildMessageQuery())
+ ->setViewer($viewer)
+ ->withReceiverPHIDs(array($this->getPHID()))
+ ->execute();
+ foreach ($messages as $message) {
+ $engine->destroyObject($message);
+ }
+
+ $this->delete();
+ $this->saveTransaction();
+ }
+
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 12:53 AM (2 d, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7711252
Default Alt Text
D19269.diff (9 KB)
Attached To
Mode
D19269: Make Harbormaster objects destructible
Attached
Detach File
Event Timeline
Log In to Comment