Path: blob/master/src/applications/conduit/query/PhabricatorConduitLogQuery.php
12262 views
<?php12final class PhabricatorConduitLogQuery3extends PhabricatorCursorPagedPolicyAwareQuery {45private $ids;6private $callerPHIDs;7private $methods;8private $methodStatuses;9private $epochMin;10private $epochMax;1112public function withIDs(array $ids) {13$this->ids = $ids;14return $this;15}1617public function withCallerPHIDs(array $phids) {18$this->callerPHIDs = $phids;19return $this;20}2122public function withMethods(array $methods) {23$this->methods = $methods;24return $this;25}2627public function withMethodStatuses(array $statuses) {28$this->methodStatuses = $statuses;29return $this;30}3132public function withEpochBetween($epoch_min, $epoch_max) {33$this->epochMin = $epoch_min;34$this->epochMax = $epoch_max;35return $this;36}3738public function newResultObject() {39return new PhabricatorConduitMethodCallLog();40}4142protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {43$where = parent::buildWhereClauseParts($conn);4445if ($this->ids !== null) {46$where[] = qsprintf(47$conn,48'id IN (%Ld)',49$this->ids);50}5152if ($this->callerPHIDs !== null) {53$where[] = qsprintf(54$conn,55'callerPHID IN (%Ls)',56$this->callerPHIDs);57}5859if ($this->methods !== null) {60$where[] = qsprintf(61$conn,62'method IN (%Ls)',63$this->methods);64}6566if ($this->methodStatuses !== null) {67$statuses = array_fuse($this->methodStatuses);6869$methods = id(new PhabricatorConduitMethodQuery())70->setViewer($this->getViewer())71->execute();7273$method_names = array();74foreach ($methods as $method) {75$status = $method->getMethodStatus();76if (isset($statuses[$status])) {77$method_names[] = $method->getAPIMethodName();78}79}8081if (!$method_names) {82throw new PhabricatorEmptyQueryException();83}8485$where[] = qsprintf(86$conn,87'method IN (%Ls)',88$method_names);89}9091if ($this->epochMin !== null) {92$where[] = qsprintf(93$conn,94'dateCreated >= %d',95$this->epochMin);96}9798if ($this->epochMax !== null) {99$where[] = qsprintf(100$conn,101'dateCreated <= %d',102$this->epochMax);103}104105return $where;106}107108public function getQueryApplicationClass() {109return 'PhabricatorConduitApplication';110}111112}113114115