Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/harbormaster/DiffusionBuildableEngine.php
12241 views
1
<?php
2
3
final 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
}
44
45