Path: blob/master/src/applications/chatlog/query/PhabricatorChatLogChannelQuery.php
13402 views
<?php12final class PhabricatorChatLogChannelQuery3extends PhabricatorCursorPagedPolicyAwareQuery {45private $channels;6private $channelIDs;78public function withChannelNames(array $channels) {9$this->channels = $channels;10return $this;11}1213public function withIDs(array $channel_ids) {14$this->channelIDs = $channel_ids;15return $this;16}1718protected function loadPage() {19$table = new PhabricatorChatLogChannel();20$conn_r = $table->establishConnection('r');2122$data = queryfx_all(23$conn_r,24'SELECT * FROM %T c %Q %Q %Q',25$table->getTableName(),26$this->buildWhereClause($conn_r),27$this->buildOrderClause($conn_r),28$this->buildLimitClause($conn_r));2930$logs = $table->loadAllFromArray($data);3132return $logs;33}3435protected function buildWhereClause(AphrontDatabaseConnection $conn) {36$where = array();3738$where[] = $this->buildPagingClause($conn);3940if ($this->channelIDs) {41$where[] = qsprintf(42$conn,43'id IN (%Ld)',44$this->channelIDs);4546}4748if ($this->channels) {49$where[] = qsprintf(50$conn,51'channelName IN (%Ls)',52$this->channels);53}5455return $this->formatWhereClause($conn, $where);56}5758public function getQueryApplicationClass() {59return 'PhabricatorChatLogApplication';60}6162}636465