@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class DiffusionBuildableEngine
4 extends HarbormasterBuildableEngine {
5
6 public function publishBuildable(
7 HarbormasterBuildable $old,
8 HarbormasterBuildable $new) {
9
10 // Don't publish manual buildables.
11 if ($new->getIsManualBuildable()) {
12 return;
13 }
14
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;
22 }
23
24 // Don't publish anything if the buildable is still building.
25 if ($new->isBuilding()) {
26 return;
27 }
28
29 $xaction = $this->newTransaction()
30 ->setMetadataValue('harbormaster:buildablePHID', $new->getPHID())
31 ->setTransactionType(DiffusionCommitBuildableTransaction::TRANSACTIONTYPE)
32 ->setNewValue($new->getBuildableStatus());
33
34 $this->applyTransactions(array($xaction));
35 }
36
37 public function getAuthorIdentity() {
38 return $this->getObject()
39 ->loadIdentities($this->getViewer())
40 ->getAuthorIdentity();
41 }
42
43}