@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 88 lines 2.0 kB view raw
1<?php 2 3/** 4 * @extends PhabricatorCursorPagedPolicyAwareQuery<HarbormasterBuildStep> 5 */ 6final class HarbormasterBuildStepQuery 7 extends PhabricatorCursorPagedPolicyAwareQuery { 8 9 private $ids; 10 private $phids; 11 private $buildPlanPHIDs; 12 13 public function withIDs(array $ids) { 14 $this->ids = $ids; 15 return $this; 16 } 17 18 public function withPHIDs(array $phids) { 19 $this->phids = $phids; 20 return $this; 21 } 22 23 public function withBuildPlanPHIDs(array $phids) { 24 $this->buildPlanPHIDs = $phids; 25 return $this; 26 } 27 28 public function newResultObject() { 29 return new HarbormasterBuildStep(); 30 } 31 32 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 33 $where = parent::buildWhereClauseParts($conn); 34 35 if ($this->ids !== null) { 36 $where[] = qsprintf( 37 $conn, 38 'id IN (%Ld)', 39 $this->ids); 40 } 41 42 if ($this->phids !== null) { 43 $where[] = qsprintf( 44 $conn, 45 'phid in (%Ls)', 46 $this->phids); 47 } 48 49 if ($this->buildPlanPHIDs !== null) { 50 $where[] = qsprintf( 51 $conn, 52 'buildPlanPHID in (%Ls)', 53 $this->buildPlanPHIDs); 54 } 55 56 return $where; 57 } 58 59 protected function willFilterPage(array $page) { 60 $plans = array(); 61 62 $buildplan_phids = array_filter(mpull($page, 'getBuildPlanPHID')); 63 if ($buildplan_phids) { 64 $plans = id(new PhabricatorObjectQuery()) 65 ->setViewer($this->getViewer()) 66 ->withPHIDs($buildplan_phids) 67 ->setParentQuery($this) 68 ->execute(); 69 $plans = mpull($plans, null, 'getPHID'); 70 } 71 72 foreach ($page as $key => $build) { 73 $buildable_phid = $build->getBuildPlanPHID(); 74 if (empty($plans[$buildable_phid])) { 75 unset($page[$key]); 76 continue; 77 } 78 $build->attachBuildPlan($plans[$buildable_phid]); 79 } 80 81 return $page; 82 } 83 84 public function getQueryApplicationClass() { 85 return PhabricatorHarbormasterApplication::class; 86 } 87 88}