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

Add date range filtering for activity, push, and pull logs

Summary: Ref T13049. This is just a general nice-to-have so you don't have to export a 300MB file if you want to check the last month of data or whatever.

Test Plan: Applied filters to all three logs, got appropriate date-range result sets.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13049

Differential Revision: https://secure.phabricator.com/D18970

+105
+12
src/applications/diffusion/query/DiffusionPullLogSearchEngine.php
··· 26 26 $query->withPullerPHIDs($map['pullerPHIDs']); 27 27 } 28 28 29 + if ($map['createdStart'] || $map['createdEnd']) { 30 + $query->withEpochBetween( 31 + $map['createdStart'], 32 + $map['createdEnd']); 33 + } 34 + 29 35 return $query; 30 36 } 31 37 ··· 44 50 ->setLabel(pht('Pullers')) 45 51 ->setDescription( 46 52 pht('Search for pull logs by specific users.')), 53 + id(new PhabricatorSearchDateField()) 54 + ->setLabel(pht('Created After')) 55 + ->setKey('createdStart'), 56 + id(new PhabricatorSearchDateField()) 57 + ->setLabel(pht('Created Before')) 58 + ->setKey('createdEnd'), 47 59 ); 48 60 } 49 61
+22
src/applications/people/query/PhabricatorPeopleLogQuery.php
··· 9 9 private $sessionKeys; 10 10 private $actions; 11 11 private $remoteAddressPrefix; 12 + private $dateCreatedMin; 13 + private $dateCreatedMax; 12 14 13 15 public function withActorPHIDs(array $actor_phids) { 14 16 $this->actorPHIDs = $actor_phids; ··· 37 39 38 40 public function withRemoteAddressPrefix($remote_address_prefix) { 39 41 $this->remoteAddressPrefix = $remote_address_prefix; 42 + return $this; 43 + } 44 + 45 + public function withDateCreatedBetween($min, $max) { 46 + $this->dateCreatedMin = $min; 47 + $this->dateCreatedMax = $max; 40 48 return $this; 41 49 } 42 50 ··· 92 100 $conn, 93 101 'remoteAddr LIKE %>', 94 102 $this->remoteAddressPrefix); 103 + } 104 + 105 + if ($this->dateCreatedMin !== null) { 106 + $where[] = qsprintf( 107 + $conn, 108 + 'dateCreated >= %d', 109 + $this->dateCreatedMin); 110 + } 111 + 112 + if ($this->dateCreatedMax !== null) { 113 + $where[] = qsprintf( 114 + $conn, 115 + 'dateCreated <= %d', 116 + $this->dateCreatedMax); 95 117 } 96 118 97 119 return $where;
+12
src/applications/people/query/PhabricatorPeopleLogSearchEngine.php
··· 54 54 $query->withSessionKeys($map['sessions']); 55 55 } 56 56 57 + if ($map['createdStart'] || $map['createdEnd']) { 58 + $query->withDateCreatedBetween( 59 + $map['createdStart'], 60 + $map['createdEnd']); 61 + } 62 + 57 63 return $query; 58 64 } 59 65 ··· 82 88 ->setKey('sessions') 83 89 ->setLabel(pht('Sessions')) 84 90 ->setDescription(pht('Search for activity in particular sessions.')), 91 + id(new PhabricatorSearchDateField()) 92 + ->setLabel(pht('Created After')) 93 + ->setKey('createdStart'), 94 + id(new PhabricatorSearchDateField()) 95 + ->setLabel(pht('Created Before')) 96 + ->setKey('createdEnd'), 85 97 ); 86 98 } 87 99
+22
src/applications/repository/query/PhabricatorRepositoryPullEventQuery.php
··· 7 7 private $phids; 8 8 private $repositoryPHIDs; 9 9 private $pullerPHIDs; 10 + private $epochMin; 11 + private $epochMax; 10 12 11 13 public function withIDs(array $ids) { 12 14 $this->ids = $ids; ··· 25 27 26 28 public function withPullerPHIDs(array $puller_phids) { 27 29 $this->pullerPHIDs = $puller_phids; 30 + return $this; 31 + } 32 + 33 + public function withEpochBetween($min, $max) { 34 + $this->epochMin = $min; 35 + $this->epochMax = $max; 28 36 return $this; 29 37 } 30 38 ··· 101 109 $conn, 102 110 'pullerPHID in (%Ls)', 103 111 $this->pullerPHIDs); 112 + } 113 + 114 + if ($this->epochMin !== null) { 115 + $where[] = qsprintf( 116 + $conn, 117 + 'epoch >= %d', 118 + $this->epochMin); 119 + } 120 + 121 + if ($this->epochMax !== null) { 122 + $where[] = qsprintf( 123 + $conn, 124 + 'epoch <= %d', 125 + $this->epochMax); 104 126 } 105 127 106 128 return $where;
+22
src/applications/repository/query/PhabricatorRepositoryPushLogQuery.php
··· 10 10 private $refTypes; 11 11 private $newRefs; 12 12 private $pushEventPHIDs; 13 + private $epochMin; 14 + private $epochMax; 13 15 14 16 public function withIDs(array $ids) { 15 17 $this->ids = $ids; ··· 43 45 44 46 public function withPushEventPHIDs(array $phids) { 45 47 $this->pushEventPHIDs = $phids; 48 + return $this; 49 + } 50 + 51 + public function withEpochBetween($min, $max) { 52 + $this->epochMin = $min; 53 + $this->epochMax = $max; 46 54 return $this; 47 55 } 48 56 ··· 125 133 $conn, 126 134 'refNew IN (%Ls)', 127 135 $this->newRefs); 136 + } 137 + 138 + if ($this->epochMin !== null) { 139 + $where[] = qsprintf( 140 + $conn, 141 + 'epoch >= %d', 142 + $this->epochMin); 143 + } 144 + 145 + if ($this->epochMax !== null) { 146 + $where[] = qsprintf( 147 + $conn, 148 + 'epoch <= %d', 149 + $this->epochMax); 128 150 } 129 151 130 152 return $where;
+12
src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
··· 26 26 $query->withPusherPHIDs($map['pusherPHIDs']); 27 27 } 28 28 29 + if ($map['createdStart'] || $map['createdEnd']) { 30 + $query->withEpochBetween( 31 + $map['createdStart'], 32 + $map['createdEnd']); 33 + } 34 + 29 35 return $query; 30 36 } 31 37 ··· 44 50 ->setLabel(pht('Pushers')) 45 51 ->setDescription( 46 52 pht('Search for pull logs by specific users.')), 53 + id(new PhabricatorSearchDateField()) 54 + ->setLabel(pht('Created After')) 55 + ->setKey('createdStart'), 56 + id(new PhabricatorSearchDateField()) 57 + ->setLabel(pht('Created Before')) 58 + ->setKey('createdEnd'), 47 59 ); 48 60 } 49 61
+3
src/applications/repository/storage/PhabricatorRepositoryPushLog.php
··· 124 124 'key_pusher' => array( 125 125 'columns' => array('pusherPHID'), 126 126 ), 127 + 'key_epoch' => array( 128 + 'columns' => array('epoch'), 129 + ), 127 130 ), 128 131 ) + parent::getConfiguration(); 129 132 }