Differential D16166 Diff 38890 src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Show First 20 Lines • Show All 925 Lines • ▼ Show 20 Lines | $comment_editor = id(new PhabricatorApplicationTransactionCommentEditor()) | ||||
->setActor($actor) | ->setActor($actor) | ||||
->setActingAsPHID($this->getActingAsPHID()) | ->setActingAsPHID($this->getActingAsPHID()) | ||||
->setContentSource($this->getContentSource()); | ->setContentSource($this->getContentSource()); | ||||
if (!$transaction_open) { | if (!$transaction_open) { | ||||
$object->openTransaction(); | $object->openTransaction(); | ||||
} | } | ||||
try { | |||||
foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
$this->applyInternalEffects($object, $xaction); | $this->applyInternalEffects($object, $xaction); | ||||
} | } | ||||
$xactions = $this->didApplyInternalEffects($object, $xactions); | $xactions = $this->didApplyInternalEffects($object, $xactions); | ||||
try { | try { | ||||
$object->save(); | $object->save(); | ||||
} catch (AphrontDuplicateKeyQueryException $ex) { | } catch (AphrontDuplicateKeyQueryException $ex) { | ||||
$object->killTransaction(); | |||||
// This callback has an opportunity to throw a better exception, | // This callback has an opportunity to throw a better exception, | ||||
// so execution may end here. | // so execution may end here. | ||||
$this->didCatchDuplicateKeyException($object, $xactions, $ex); | $this->didCatchDuplicateKeyException($object, $xactions, $ex); | ||||
throw $ex; | throw $ex; | ||||
} | } | ||||
foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
Show All 15 Lines | try { | ||||
} | } | ||||
$xactions = $this->applyFinalEffects($object, $xactions); | $xactions = $this->applyFinalEffects($object, $xactions); | ||||
if ($read_locking) { | if ($read_locking) { | ||||
$object->endReadLocking(); | $object->endReadLocking(); | ||||
$read_locking = false; | $read_locking = false; | ||||
} | } | ||||
$object->saveTransaction(); | $object->saveTransaction(); | ||||
} catch (Exception $ex) { | |||||
$object->killTransaction(); | |||||
throw $ex; | |||||
} | |||||
// Now that we've completely applied the core transaction set, try to apply | // Now that we've completely applied the core transaction set, try to apply | ||||
// Herald rules. Herald rules are allowed to either take direct actions on | // Herald rules. Herald rules are allowed to either take direct actions on | ||||
// the database (like writing flags), or take indirect actions (like saving | // the database (like writing flags), or take indirect actions (like saving | ||||
// some targets for CC when we generate mail a little later), or return | // some targets for CC when we generate mail a little later), or return | ||||
// transactions which we'll apply normally using another Editor. | // transactions which we'll apply normally using another Editor. | ||||
// First, check if *this* is a sub-editor which is itself applying Herald | // First, check if *this* is a sub-editor which is itself applying Herald | ||||
▲ Show 20 Lines • Show All 2,812 Lines • Show Last 20 Lines |