@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 91 lines 2.5 kB view raw
1<?php 2 3final class HarbormasterQueryBuildablesConduitAPIMethod 4 extends HarbormasterConduitAPIMethod { 5 6 public function getAPIMethodName() { 7 return 'harbormaster.querybuildables'; 8 } 9 10 public function getMethodDescription() { 11 return pht('Query Harbormaster buildables.'); 12 } 13 14 protected function defineParamTypes() { 15 return array( 16 'ids' => 'optional list<id>', 17 'phids' => 'optional list<phid>', 18 'buildablePHIDs' => 'optional list<phid>', 19 'containerPHIDs' => 'optional list<phid>', 20 'manualBuildables' => 'optional bool', 21 ) + self::getPagerParamTypes(); 22 } 23 24 protected function defineReturnType() { 25 return 'wild'; 26 } 27 28 protected function execute(ConduitAPIRequest $request) { 29 $viewer = $request->getUser(); 30 31 $query = id(new HarbormasterBuildableQuery()) 32 ->setViewer($viewer); 33 34 $ids = $request->getValue('ids'); 35 if ($ids !== null) { 36 $query->withIDs($ids); 37 } 38 39 $phids = $request->getValue('phids'); 40 if ($phids !== null) { 41 $query->withPHIDs($phids); 42 } 43 44 $buildable_phids = $request->getValue('buildablePHIDs'); 45 if ($buildable_phids !== null) { 46 $query->withBuildablePHIDs($buildable_phids); 47 } 48 49 $container_phids = $request->getValue('containerPHIDs'); 50 if ($container_phids !== null) { 51 $query->withContainerPHIDs($container_phids); 52 } 53 54 $manual = $request->getValue('manualBuildables'); 55 if ($manual !== null) { 56 $query->withManualBuildables($manual); 57 } 58 59 $pager = $this->newPager($request); 60 61 $buildables = $query->executeWithCursorPager($pager); 62 63 $data = array(); 64 foreach ($buildables as $buildable) { 65 $monogram = $buildable->getMonogram(); 66 67 $status = $buildable->getBuildableStatus(); 68 $status_name = $buildable->getStatusDisplayName(); 69 70 $data[] = array( 71 'id' => $buildable->getID(), 72 'phid' => $buildable->getPHID(), 73 'monogram' => $monogram, 74 'uri' => PhabricatorEnv::getProductionURI('/'.$monogram), 75 'buildableStatus' => $status, 76 'buildableStatusName' => $status_name, 77 'buildablePHID' => $buildable->getBuildablePHID(), 78 'containerPHID' => $buildable->getContainerPHID(), 79 'isManualBuildable' => (bool)$buildable->getIsManualBuildable(), 80 ); 81 } 82 83 $results = array( 84 'data' => $data, 85 ); 86 87 $results = $this->addPagerResults($results, $pager); 88 return $results; 89 } 90 91}