mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Allow diviner books to be permanently destroyed
Summary: Fixes T7182. Test Plan: Deleted a book with `./bin/remove destroy` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7182 Differential Revision: https://secure.phabricator.com/D11742
This commit is contained in:
parent
edc7fcbd5a
commit
5a20daedc7
2 changed files with 46 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
final class DivinerLiveBook extends DivinerDAO
|
||||
implements PhabricatorPolicyInterface {
|
||||
implements
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
protected $name;
|
||||
protected $viewPolicy;
|
||||
|
@ -82,4 +84,25 @@ final class DivinerLiveBook extends DivinerDAO
|
|||
return null;
|
||||
}
|
||||
|
||||
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$atoms = id(new DivinerAtomQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->withBookPHIDs(array($this->getPHID()))
|
||||
->withIncludeGhosts(true)
|
||||
->withIncludeUndocumentable(true)
|
||||
->execute();
|
||||
|
||||
foreach ($atoms as $atom) {
|
||||
$engine->destroyObject($atom);
|
||||
}
|
||||
|
||||
$this->delete();
|
||||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 @@ final class DivinerLiveSymbol extends DivinerDAO
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue