Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialRevision.php
| Show First 20 Lines • Show All 996 Lines • ▼ Show 20 Lines | |||||
| /* -( PhabricatorDestructibleInterface )----------------------------------- */ | /* -( PhabricatorDestructibleInterface )----------------------------------- */ | ||||
| public function destroyObjectPermanently( | public function destroyObjectPermanently( | ||||
| PhabricatorDestructionEngine $engine) { | PhabricatorDestructionEngine $engine) { | ||||
| $viewer = $engine->getViewer(); | |||||
| $this->openTransaction(); | $this->openTransaction(); | ||||
| $diffs = id(new DifferentialDiffQuery()) | $diffs = id(new DifferentialDiffQuery()) | ||||
| ->setViewer($engine->getViewer()) | ->setViewer($viewer) | ||||
| ->withRevisionIDs(array($this->getID())) | ->withRevisionIDs(array($this->getID())) | ||||
| ->execute(); | ->execute(); | ||||
| foreach ($diffs as $diff) { | foreach ($diffs as $diff) { | ||||
| $engine->destroyObject($diff); | $engine->destroyObject($diff); | ||||
| } | } | ||||
| $conn_w = $this->establishConnection('w'); | $conn_w = $this->establishConnection('w'); | ||||
| // we have to do paths a little differently as they do not have | // we have to do paths a little differently as they do not have | ||||
| // an id or phid column for delete() to act on | // an id or phid column for delete() to act on | ||||
| $dummy_path = new DifferentialAffectedPath(); | $dummy_path = new DifferentialAffectedPath(); | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'DELETE FROM %T WHERE revisionID = %d', | 'DELETE FROM %T WHERE revisionID = %d', | ||||
| $dummy_path->getTableName(), | $dummy_path->getTableName(), | ||||
| $this->getID()); | $this->getID()); | ||||
| $viewstates = id(new DifferentialViewStateQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withObjectPHIDs(array($this->getPHID())); | |||||
| foreach ($viewstates as $viewstate) { | |||||
| $viewstate->delete(); | |||||
| } | |||||
| $this->delete(); | $this->delete(); | ||||
| $this->saveTransaction(); | $this->saveTransaction(); | ||||
| } | } | ||||
| /* -( PhabricatorFulltextInterface )--------------------------------------- */ | /* -( PhabricatorFulltextInterface )--------------------------------------- */ | ||||
| ▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines | |||||