mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 14:30:56 +01:00
Allow Phriction documents to be permanently deleted
Summary: Allow `PhrictionDocument` to be permanently deleted with `./bin/remove destroy`. Test Plan: Deleted a Phriction document with `./bin/remove` and verified that the database was in the expected state. ``` > ./bin/remove destroy PHID-WIKI-auj57rauigvcqvv5feh6 IMPORTANT: OBJECTS WILL BE PERMANENTLY DESTROYED! There is no way to undo this operation or ever retrieve this data. These 1 object(s) will be completely destroyed forever: - PHID-WIKI-auj57rauigvcqvv5feh6 (PhrictionDocument) Are you absolutely certain you want to destroy these 1 object(s)? [y/N] y Destroying objects... Destroying PhrictionDocument PHID-WIKI-auj57rauigvcqvv5feh6... Permanently destroyed 1 object(s). ``` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9976
This commit is contained in:
parent
17afcdcf95
commit
63ce0e66c9
1 changed files with 24 additions and 1 deletions
|
@ -5,7 +5,8 @@ final class PhrictionDocument extends PhrictionDAO
|
|||
PhabricatorPolicyInterface,
|
||||
PhabricatorSubscribableInterface,
|
||||
PhabricatorFlaggableInterface,
|
||||
PhabricatorTokenReceiverInterface {
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorDestructableInterface {
|
||||
|
||||
protected $slug;
|
||||
protected $depth;
|
||||
|
@ -180,4 +181,26 @@ final class PhrictionDocument extends PhrictionDAO
|
|||
public function getUsersToNotifyOfTokenGiven() {
|
||||
return PhabricatorSubscribersQuery::loadSubscribersForPHID($this->phid);
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorDestructableInterface )----------------------------------- */
|
||||
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
|
||||
$this->delete();
|
||||
|
||||
$contents = id(new PhrictionContent())->loadAllWhere(
|
||||
'documentID = %d',
|
||||
$this->getID());
|
||||
foreach ($contents as $content) {
|
||||
$content->delete();
|
||||
}
|
||||
|
||||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue