diff --git a/src/applications/differential/xaction/DifferentialRevisionUpdateTransaction.php b/src/applications/differential/xaction/DifferentialRevisionUpdateTransaction.php --- a/src/applications/differential/xaction/DifferentialRevisionUpdateTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionUpdateTransaction.php @@ -57,6 +57,12 @@ // Harbormaster. See discussion in T8650. $diff->setRevisionID($object->getID()); $diff->save(); + } + + public function didCommitTransaction($object, $value) { + $editor = $this->getEditor(); + $diff = $editor->requireDiff($value); + $omnipotent = PhabricatorUser::getOmnipotentUser(); // If there are any outstanding buildables for this diff, tell // Harbormaster that their containers need to be updated. This is @@ -64,7 +70,7 @@ // and unit results. $buildables = id(new HarbormasterBuildableQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->setViewer($omnipotent) ->withManualBuildables(false) ->withBuildablePHIDs(array($diff->getPHID())) ->execute(); diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -869,6 +869,24 @@ return $xactions; } + final protected function didCommitTransactions( + PhabricatorLiskDAO $object, + array $xactions) { + + foreach ($xactions as $xaction) { + $type = $xaction->getTransactionType(); + + $xtype = $this->getModularTransactionType($type); + if (!$xtype) { + continue; + } + + $xtype = clone $xtype; + $xtype->setStorage($xaction); + $xtype->didCommitTransaction($object, $xaction->getNewValue()); + } + } + public function setContentSource(PhabricatorContentSource $content_source) { $this->contentSource = $content_source; return $this; @@ -1106,6 +1124,9 @@ $object->saveTransaction(); $transaction_open = false; } + + $this->didCommitTransactions($object, $xactions); + } catch (Exception $ex) { if ($read_locking) { $object->endReadLocking(); diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php --- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php +++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php @@ -35,6 +35,10 @@ return; } + public function didCommitTransaction($object, $value) { + return; + } + public function getTransactionHasEffect($object, $old, $new) { return ($old !== $new); } diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php --- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php +++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php @@ -103,26 +103,26 @@ return $this->formatWhereClause($conn, $where); } - protected function buildOrderClause(AphrontDatabaseConnection $conn_r) { + protected function buildOrderClause(AphrontDatabaseConnection $conn) { // NOTE: The garbage collector executes this query with a date constraint, // and the query is inefficient if we don't use the same key for ordering. // See T9808 for discussion. if ($this->dateCreatedBefore) { - return qsprintf($conn_r, 'ORDER BY dateCreated DESC, id DESC'); + return qsprintf($conn, 'ORDER BY dateCreated DESC, id DESC'); } else if ($this->dateModifiedSince) { - return qsprintf($conn_r, 'ORDER BY dateModified DESC, id DESC'); + return qsprintf($conn, 'ORDER BY dateModified DESC, id DESC'); } else { - return qsprintf($conn_r, 'ORDER BY id DESC'); + return qsprintf($conn, 'ORDER BY id DESC'); } } - protected function buildLimitClause(AphrontDatabaseConnection $conn_r) { - $clause = ''; + protected function buildLimitClause(AphrontDatabaseConnection $conn) { if ($this->limit) { - $clause = qsprintf($conn_r, 'LIMIT %d', $this->limit); + return qsprintf($conn, 'LIMIT %d', $this->limit); + } else { + return qsprintf($conn, ''); } - return $clause; } } diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php --- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php +++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php @@ -145,19 +145,23 @@ return $triggers; } - protected function buildJoinClause(AphrontDatabaseConnection $conn_r) { + protected function buildJoinClause(AphrontDatabaseConnection $conn) { $joins = array(); if (($this->nextEpochMin !== null) || ($this->nextEpochMax !== null) || ($this->order == self::ORDER_EXECUTION)) { $joins[] = qsprintf( - $conn_r, + $conn, 'JOIN %T e ON e.triggerID = t.id', id(new PhabricatorWorkerTriggerEvent())->getTableName()); } - return implode(' ', $joins); + if ($joins) { + return qsprintf($conn, '%LJ', $joins); + } else { + return qsprintf($conn, ''); + } } protected function buildWhereClause(AphrontDatabaseConnection $conn) {