Differential D19789 Diff 47302 src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php
| Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | if (($this->nextEpochMin !== null) || | ||||
| $conn_r, | $conn_r, | ||||
| 'JOIN %T e ON e.triggerID = t.id', | 'JOIN %T e ON e.triggerID = t.id', | ||||
| id(new PhabricatorWorkerTriggerEvent())->getTableName()); | id(new PhabricatorWorkerTriggerEvent())->getTableName()); | ||||
| } | } | ||||
| return implode(' ', $joins); | return implode(' ', $joins); | ||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = array(); | ||||
| if ($this->ids !== null) { | if ($this->ids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 't.id IN (%Ld)', | 't.id IN (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->phids !== null) { | if ($this->phids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 't.phid IN (%Ls)', | 't.phid IN (%Ls)', | ||||
| $this->phids); | $this->phids); | ||||
| } | } | ||||
| if ($this->versionMin !== null) { | if ($this->versionMin !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 't.triggerVersion >= %d', | 't.triggerVersion >= %d', | ||||
| $this->versionMin); | $this->versionMin); | ||||
| } | } | ||||
| if ($this->versionMax !== null) { | if ($this->versionMax !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 't.triggerVersion <= %d', | 't.triggerVersion <= %d', | ||||
| $this->versionMax); | $this->versionMax); | ||||
| } | } | ||||
| if ($this->nextEpochMin !== null) { | if ($this->nextEpochMin !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'e.nextEventEpoch >= %d', | 'e.nextEventEpoch >= %d', | ||||
| $this->nextEpochMin); | $this->nextEpochMin); | ||||
| } | } | ||||
| if ($this->nextEpochMax !== null) { | if ($this->nextEpochMax !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'e.nextEventEpoch <= %d', | 'e.nextEventEpoch <= %d', | ||||
| $this->nextEpochMax); | $this->nextEpochMax); | ||||
| } | } | ||||
| return $this->formatWhereClause($where); | return $this->formatWhereClause($conn, $where); | ||||
| } | } | ||||
| private function buildOrderClause(AphrontDatabaseConnection $conn_r) { | private function buildOrderClause(AphrontDatabaseConnection $conn_r) { | ||||
| switch ($this->order) { | switch ($this->order) { | ||||
| case self::ORDER_ID: | case self::ORDER_ID: | ||||
| return qsprintf( | return qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| 'ORDER BY id DESC'); | 'ORDER BY id DESC'); | ||||
| Show All 17 Lines | |||||