Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / diffusion / harbormaster / DiffusionBuildableEngine.php
blob748386f1bd0e5a3c72f191a320bf060ef0dbccdb
1 <?php
3 final class DiffusionBuildableEngine
4 extends HarbormasterBuildableEngine {
6 public function publishBuildable(
7 HarbormasterBuildable $old,
8 HarbormasterBuildable $new) {
10 // Don't publish manual buildables.
11 if ($new->getIsManualBuildable()) {
12 return;
15 // Don't publish anything if the buildable status has not changed. At
16 // least for now, Diffusion handles buildable status exactly the same
17 // way that Harbormaster does.
18 $old_status = $old->getBuildableStatus();
19 $new_status = $new->getBuildableStatus();
20 if ($old_status === $new_status) {
21 return;
24 // Don't publish anything if the buildable is still building.
25 if ($new->isBuilding()) {
26 return;
29 $xaction = $this->newTransaction()
30 ->setMetadataValue('harbormaster:buildablePHID', $new->getPHID())
31 ->setTransactionType(DiffusionCommitBuildableTransaction::TRANSACTIONTYPE)
32 ->setNewValue($new->getBuildableStatus());
34 $this->applyTransactions(array($xaction));
37 public function getAuthorIdentity() {
38 return $this->getObject()
39 ->loadIdentities($this->getViewer())
40 ->getAuthorIdentity();