Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/query/PhabricatorConduitTokenQuery.php
| <?php | <?php | ||||
| final class PhabricatorConduitTokenQuery | final class PhabricatorConduitTokenQuery | ||||
| extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
| private $ids; | private $ids; | ||||
| private $objectPHIDs; | private $objectPHIDs; | ||||
| private $expired; | private $expired; | ||||
| private $tokens; | |||||
| public function withExpired($expired) { | public function withExpired($expired) { | ||||
| $this->expired = $expired; | $this->expired = $expired; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withIDs(array $ids) { | public function withIDs(array $ids) { | ||||
| $this->ids = $ids; | $this->ids = $ids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withObjectPHIDs(array $phids) { | public function withObjectPHIDs(array $phids) { | ||||
| $this->objectPHIDs = $phids; | $this->objectPHIDs = $phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withTokens(array $tokens) { | |||||
| $this->tokens = $tokens; | |||||
| return $this; | |||||
| } | |||||
| public function loadPage() { | public function loadPage() { | ||||
| $table = new PhabricatorConduitToken(); | $table = new PhabricatorConduitToken(); | ||||
| $conn_r = $table->establishConnection('r'); | $conn_r = $table->establishConnection('r'); | ||||
| $data = queryfx_all( | $data = queryfx_all( | ||||
| $conn_r, | $conn_r, | ||||
| 'SELECT * FROM %T %Q %Q %Q', | 'SELECT * FROM %T %Q %Q %Q', | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| Show All 16 Lines | private function buildWhereClause(AphrontDatabaseConnection $conn_r) { | ||||
| if ($this->objectPHIDs !== null) { | if ($this->objectPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| 'objectPHID IN (%Ls)', | 'objectPHID IN (%Ls)', | ||||
| $this->objectPHIDs); | $this->objectPHIDs); | ||||
| } | } | ||||
| if ($this->tokens !== null) { | |||||
| $where[] = qsprintf( | |||||
| $conn_r, | |||||
| 'token IN (%Ls)', | |||||
| $this->tokens); | |||||
| } | |||||
| if ($this->expired !== null) { | if ($this->expired !== null) { | ||||
| if ($this->expired) { | if ($this->expired) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| 'expires <= %d', | 'expires <= %d', | ||||
| PhabricatorTime::getNow()); | PhabricatorTime::getNow()); | ||||
| } else { | } else { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| Show All 38 Lines | |||||