@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 138 lines 3.0 kB view raw
1<?php 2 3/** 4 * @extends PhabricatorCursorPagedPolicyAwareQuery<PhabricatorUserLog> 5 */ 6final class PhabricatorPeopleLogQuery 7 extends PhabricatorCursorPagedPolicyAwareQuery { 8 9 private $ids; 10 private $actorPHIDs; 11 private $userPHIDs; 12 private $relatedPHIDs; 13 private $sessionKeys; 14 private $actions; 15 private $remoteAddressPrefix; 16 private $dateCreatedMin; 17 private $dateCreatedMax; 18 19 public function withIDs(array $ids) { 20 $this->ids = $ids; 21 return $this; 22 } 23 24 public function withActorPHIDs(array $actor_phids) { 25 $this->actorPHIDs = $actor_phids; 26 return $this; 27 } 28 29 public function withUserPHIDs(array $user_phids) { 30 $this->userPHIDs = $user_phids; 31 return $this; 32 } 33 34 public function withRelatedPHIDs(array $related_phids) { 35 $this->relatedPHIDs = $related_phids; 36 return $this; 37 } 38 39 public function withSessionKeys(array $session_keys) { 40 $this->sessionKeys = $session_keys; 41 return $this; 42 } 43 44 public function withActions(array $actions) { 45 $this->actions = $actions; 46 return $this; 47 } 48 49 public function withRemoteAddressPrefix($remote_address_prefix) { 50 $this->remoteAddressPrefix = $remote_address_prefix; 51 return $this; 52 } 53 54 public function withDateCreatedBetween($min, $max) { 55 $this->dateCreatedMin = $min; 56 $this->dateCreatedMax = $max; 57 return $this; 58 } 59 60 public function newResultObject() { 61 return new PhabricatorUserLog(); 62 } 63 64 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 65 $where = parent::buildWhereClauseParts($conn); 66 67 if ($this->ids !== null) { 68 $where[] = qsprintf( 69 $conn, 70 'id IN (%Ld)', 71 $this->ids); 72 } 73 74 if ($this->actorPHIDs !== null) { 75 $where[] = qsprintf( 76 $conn, 77 'actorPHID IN (%Ls)', 78 $this->actorPHIDs); 79 } 80 81 if ($this->userPHIDs !== null) { 82 $where[] = qsprintf( 83 $conn, 84 'userPHID IN (%Ls)', 85 $this->userPHIDs); 86 } 87 88 if ($this->relatedPHIDs !== null) { 89 $where[] = qsprintf( 90 $conn, 91 '(actorPHID IN (%Ls) OR userPHID IN (%Ls))', 92 $this->relatedPHIDs, 93 $this->relatedPHIDs); 94 } 95 96 if ($this->sessionKeys !== null) { 97 $where[] = qsprintf( 98 $conn, 99 'session IN (%Ls)', 100 $this->sessionKeys); 101 } 102 103 if ($this->actions !== null) { 104 $where[] = qsprintf( 105 $conn, 106 'action IN (%Ls)', 107 $this->actions); 108 } 109 110 if ($this->remoteAddressPrefix !== null) { 111 $where[] = qsprintf( 112 $conn, 113 'remoteAddr LIKE %>', 114 $this->remoteAddressPrefix); 115 } 116 117 if ($this->dateCreatedMin !== null) { 118 $where[] = qsprintf( 119 $conn, 120 'dateCreated >= %d', 121 $this->dateCreatedMin); 122 } 123 124 if ($this->dateCreatedMax !== null) { 125 $where[] = qsprintf( 126 $conn, 127 'dateCreated <= %d', 128 $this->dateCreatedMax); 129 } 130 131 return $where; 132 } 133 134 public function getQueryApplicationClass() { 135 return PhabricatorPeopleApplication::class; 136 } 137 138}