@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 106 lines 2.3 kB view raw
1<?php 2 3/** 4 * @extends PhabricatorCursorPagedPolicyAwareQuery<PhabricatorCountdown> 5 */ 6final class PhabricatorCountdownQuery 7 extends PhabricatorCursorPagedPolicyAwareQuery { 8 9 private $ids; 10 private $phids; 11 private $authorPHIDs; 12 private $upcoming; 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 $author_phids) { 25 $this->authorPHIDs = $author_phids; 26 return $this; 27 } 28 29 public function withUpcoming() { 30 $this->upcoming = true; 31 return $this; 32 } 33 34 public function newResultObject() { 35 return new PhabricatorCountdown(); 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 'id IN (%Ld)', 45 $this->ids); 46 } 47 48 if ($this->phids !== null) { 49 $where[] = qsprintf( 50 $conn, 51 'phid IN (%Ls)', 52 $this->phids); 53 } 54 55 if ($this->authorPHIDs !== null) { 56 $where[] = qsprintf( 57 $conn, 58 'authorPHID in (%Ls)', 59 $this->authorPHIDs); 60 } 61 62 if ($this->upcoming !== null) { 63 $where[] = qsprintf( 64 $conn, 65 'epoch >= %d', 66 PhabricatorTime::getNow()); 67 } 68 69 return $where; 70 } 71 72 public function getQueryApplicationClass() { 73 return PhabricatorCountdownApplication::class; 74 } 75 76 public function getBuiltinOrders() { 77 return array( 78 'ending' => array( 79 'vector' => array('-epoch', '-id'), 80 'name' => pht('End Date (Past to Future)'), 81 ), 82 'unending' => array( 83 'vector' => array('epoch', 'id'), 84 'name' => pht('End Date (Future to Past)'), 85 ), 86 ) + parent::getBuiltinOrders(); 87 } 88 89 public function getOrderableColumns() { 90 return array( 91 'epoch' => array( 92 'table' => $this->getPrimaryTableAlias(), 93 'column' => 'epoch', 94 'type' => 'int', 95 ), 96 ) + parent::getOrderableColumns(); 97 } 98 99 protected function newPagingMapFromPartialObject($object) { 100 return array( 101 'id' => (int)$object->getID(), 102 'epoch' => (int)$object->getEpoch(), 103 ); 104 } 105 106}