Page MenuHomePhabricator

D11742.id28299.diff
No OneTemporary

D11742.id28299.diff

diff --git a/src/applications/diviner/storage/DivinerLiveBook.php b/src/applications/diviner/storage/DivinerLiveBook.php
--- a/src/applications/diviner/storage/DivinerLiveBook.php
+++ b/src/applications/diviner/storage/DivinerLiveBook.php
@@ -1,7 +1,9 @@
<?php
final class DivinerLiveBook extends DivinerDAO
- implements PhabricatorPolicyInterface {
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorDestructibleInterface {
protected $name;
protected $viewPolicy;
@@ -82,4 +84,29 @@
return null;
}
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+
+ $console = PhutilConsole::getConsole();
+ $i = 0;
+
+ $this->openTransaction();
+ $atoms = id(new DivinerAtomQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->withBookPHIDs(array($this->getPHID()))
+ ->withIncludeGhosts(true)
+ ->withIncludeUndocumentable(true)
+ ->execute();
+
+ foreach ($atoms as $atom) {
+ $console->writeOut("%d of %d\n", count($atoms), ++$i);
+ $engine->destroyObject($atom);
+ }
+
+ $this->delete();
+ $this->saveTransaction();
+ }
+
}
diff --git a/src/applications/diviner/storage/DivinerLiveSymbol.php b/src/applications/diviner/storage/DivinerLiveSymbol.php
--- a/src/applications/diviner/storage/DivinerLiveSymbol.php
+++ b/src/applications/diviner/storage/DivinerLiveSymbol.php
@@ -1,7 +1,10 @@
<?php
final class DivinerLiveSymbol extends DivinerDAO
- implements PhabricatorPolicyInterface, PhabricatorMarkupInterface {
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorMarkupInterface,
+ PhabricatorDestructibleInterface {
protected $bookPHID;
protected $context;
@@ -242,4 +245,22 @@
return true;
}
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+
+ $this->openTransaction();
+ $conn_w = $this->establishConnection('w');
+
+ queryfx(
+ $conn_w,
+ 'DELETE FROM %T WHERE symbolPHID = %s',
+ id(new DivinerLiveAtom())->getTableName(),
+ $this->getPHID());
+
+ $this->delete();
+ $this->saveTransaction();
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Oct 16 2024, 2:37 PM (5 w, 43 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717847
Default Alt Text
D11742.id28299.diff (2 KB)

Event Timeline