Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/query/PhabricatorPeopleLogQuery.php
| Show All 34 Lines | public function withActions(array $actions) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withRemoteAddressPrefix($remote_address_prefix) { | public function withRemoteAddressPrefix($remote_address_prefix) { | ||||
| $this->remoteAddressPrefix = $remote_address_prefix; | $this->remoteAddressPrefix = $remote_address_prefix; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function loadPage() { | public function newResultObject() { | ||||
| $table = new PhabricatorUserLog(); | return new PhabricatorUserLog(); | ||||
| $conn_r = $table->establishConnection('r'); | } | ||||
| $data = queryfx_all( | |||||
| $conn_r, | |||||
| 'SELECT * FROM %T %Q %Q %Q', | |||||
| $table->getTableName(), | |||||
| $this->buildWhereClause($conn_r), | |||||
| $this->buildOrderClause($conn_r), | |||||
| $this->buildLimitClause($conn_r)); | |||||
| return $table->loadAllFromArray($data); | protected function loadPage() { | ||||
| return $this->loadStandardPage($this->newResultObject()); | |||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = parent::buildWhereClauseParts($conn); | ||||
| if ($this->actorPHIDs !== null) { | if ($this->actorPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'actorPHID IN (%Ls)', | 'actorPHID IN (%Ls)', | ||||
| $this->actorPHIDs); | $this->actorPHIDs); | ||||
| } | } | ||||
| if ($this->userPHIDs !== null) { | if ($this->userPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'userPHID IN (%Ls)', | 'userPHID IN (%Ls)', | ||||
| $this->userPHIDs); | $this->userPHIDs); | ||||
| } | } | ||||
| if ($this->relatedPHIDs !== null) { | if ($this->relatedPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'actorPHID IN (%Ls) OR userPHID IN (%Ls)', | '(actorPHID IN (%Ls) OR userPHID IN (%Ls))', | ||||
| $this->relatedPHIDs, | $this->relatedPHIDs, | ||||
| $this->relatedPHIDs); | $this->relatedPHIDs); | ||||
| } | } | ||||
| if ($this->sessionKeys !== null) { | if ($this->sessionKeys !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'session IN (%Ls)', | 'session IN (%Ls)', | ||||
| $this->sessionKeys); | $this->sessionKeys); | ||||
| } | } | ||||
| if ($this->actions !== null) { | if ($this->actions !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'action IN (%Ls)', | 'action IN (%Ls)', | ||||
| $this->actions); | $this->actions); | ||||
| } | } | ||||
| if ($this->remoteAddressPrefix !== null) { | if ($this->remoteAddressPrefix !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'remoteAddr LIKE %>', | 'remoteAddr LIKE %>', | ||||
| $this->remoteAddressPrefix); | $this->remoteAddressPrefix); | ||||
| } | } | ||||
| $where[] = $this->buildPagingClause($conn_r); | return $where; | ||||
| return $this->formatWhereClause($where); | |||||
| } | } | ||||
| public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
| return 'PhabricatorPeopleApplication'; | return 'PhabricatorPeopleApplication'; | ||||
| } | } | ||||
| } | } | ||||