Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/storage/DivinerLiveBook.php
<?php | <?php | ||||
final class DivinerLiveBook extends DivinerDAO | final class DivinerLiveBook extends DivinerDAO | ||||
implements PhabricatorPolicyInterface { | implements | ||||
PhabricatorPolicyInterface, | |||||
PhabricatorDestructibleInterface { | |||||
protected $name; | protected $name; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $configurationData = array(); | protected $configurationData = array(); | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | ||||
return false; | return false; | ||||
} | } | ||||
public function describeAutomaticCapability($capability) { | public function describeAutomaticCapability($capability) { | ||||
return null; | 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(); | |||||
epriestley: I don't think destroyObjectPermanently() should print to the console.
You can use `--trace` to… | |||||
Not Done Inline ActionsOh yep, I had intended to remove this. Basically, destroying a book took a lot longer than I had expected (maybe 5 minutes). joshuaspence: Oh yep, I had intended to remove this. Basically, destroying a book took a lot longer than I… | |||||
$this->saveTransaction(); | |||||
} | |||||
} | } |
I don't think destroyObjectPermanently() should print to the console.
You can use --trace to monitor status, and it automatically keeps a log of deleted objects (bin/remove log).
If you want a progress bar specifically, we could add a destroyObjects(...) and let the Engine build the bar when run via a console? I'm generally onboard with bin/remove destroy being more verbose, but I think the Engine should be responsible, not the destroyObject...() implementations.