Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialRevision.php
| Show First 20 Lines • Show All 702 Lines • ▼ Show 20 Lines | /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ | ||||
| public function shouldBroadcast() { | public function shouldBroadcast() { | ||||
| if (!$this->isDraft()) { | if (!$this->isDraft()) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| public function loadActiveBuilds(PhabricatorUser $viewer) { | |||||
| $diff = $this->getActiveDiff(); | |||||
| $buildables = id(new HarbormasterBuildableQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withContainerPHIDs(array($this->getPHID())) | |||||
| ->withBuildablePHIDs(array($diff->getPHID())) | |||||
| ->withManualBuildables(false) | |||||
| ->execute(); | |||||
| if (!$buildables) { | |||||
| return array(); | |||||
| } | |||||
| $builds = id(new HarbormasterBuildQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withBuildablePHIDs(mpull($buildables, 'getPHID')) | |||||
| ->withBuildStatuses( | |||||
| array( | |||||
| HarbormasterBuildStatus::STATUS_INACTIVE, | |||||
| HarbormasterBuildStatus::STATUS_PENDING, | |||||
| HarbormasterBuildStatus::STATUS_BUILDING, | |||||
| HarbormasterBuildStatus::STATUS_FAILED, | |||||
| HarbormasterBuildStatus::STATUS_ABORTED, | |||||
| HarbormasterBuildStatus::STATUS_ERROR, | |||||
| HarbormasterBuildStatus::STATUS_PAUSED, | |||||
| HarbormasterBuildStatus::STATUS_DEADLOCKED, | |||||
| )) | |||||
| ->needBuildTargets(true) | |||||
| ->execute(); | |||||
| if (!$builds) { | |||||
| return array(); | |||||
| } | |||||
| $active = array(); | |||||
| foreach ($builds as $key => $build) { | |||||
| foreach ($build->getBuildTargets() as $target) { | |||||
| if ($target->isAutotarget()) { | |||||
| // Ignore autotargets when looking for active of failed builds. If | |||||
| // local tests fail and you continue anyway, you don't need to | |||||
| // double-confirm them. | |||||
| continue; | |||||
| } | |||||
| // This build has at least one real target that's doing something. | |||||
| $active[$key] = $build; | |||||
| break; | |||||
| } | |||||
| } | |||||
| return $active; | |||||
| } | |||||
| /* -( HarbormasterBuildableInterface )------------------------------------- */ | /* -( HarbormasterBuildableInterface )------------------------------------- */ | ||||
| public function getHarbormasterBuildableDisplayPHID() { | public function getHarbormasterBuildableDisplayPHID() { | ||||
| return $this->getHarbormasterContainerPHID(); | return $this->getHarbormasterContainerPHID(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines | |||||