@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 98 lines 2.1 kB view raw
1<?php 2 3/** 4 * @extends PhabricatorCursorPagedPolicyAwareQuery<PhabricatorCalendarImport> 5 */ 6final class PhabricatorCalendarImportQuery 7 extends PhabricatorCursorPagedPolicyAwareQuery { 8 9 private $ids; 10 private $phids; 11 private $authorPHIDs; 12 private $isDisabled; 13 14 public function withIDs(array $ids) { 15 $this->ids = $ids; 16 return $this; 17 } 18 19 public function withPHIDs(array $phids) { 20 $this->phids = $phids; 21 return $this; 22 } 23 24 public function withAuthorPHIDs(array $phids) { 25 $this->authorPHIDs = $phids; 26 return $this; 27 } 28 29 public function withIsDisabled($is_disabled) { 30 $this->isDisabled = $is_disabled; 31 return $this; 32 } 33 34 public function newResultObject() { 35 return new PhabricatorCalendarImport(); 36 } 37 38 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 39 $where = parent::buildWhereClauseParts($conn); 40 41 if ($this->ids !== null) { 42 $where[] = qsprintf( 43 $conn, 44 'import.id IN (%Ld)', 45 $this->ids); 46 } 47 48 if ($this->phids !== null) { 49 $where[] = qsprintf( 50 $conn, 51 'import.phid IN (%Ls)', 52 $this->phids); 53 } 54 55 if ($this->authorPHIDs !== null) { 56 $where[] = qsprintf( 57 $conn, 58 'import.authorPHID IN (%Ls)', 59 $this->authorPHIDs); 60 } 61 62 if ($this->isDisabled !== null) { 63 $where[] = qsprintf( 64 $conn, 65 'import.isDisabled = %d', 66 (int)$this->isDisabled); 67 } 68 69 return $where; 70 } 71 72 protected function willFilterPage(array $page) { 73 $engines = PhabricatorCalendarImportEngine::getAllImportEngines(); 74 foreach ($page as $key => $import) { 75 $engine_type = $import->getEngineType(); 76 $engine = idx($engines, $engine_type); 77 78 if (!$engine) { 79 unset($page[$key]); 80 $this->didRejectResult($import); 81 continue; 82 } 83 84 $import->attachEngine(clone $engine); 85 } 86 87 return $page; 88 } 89 90 protected function getPrimaryTableAlias() { 91 return 'import'; 92 } 93 94 public function getQueryApplicationClass() { 95 return PhabricatorCalendarApplication::class; 96 } 97 98}