Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/query/HeraldRuleQuery.php
| Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | foreach ($rules as $key => $rule) { | ||||
| } | } | ||||
| $rule->attachTriggerObject($object); | $rule->attachTriggerObject($object); | ||||
| } | } | ||||
| } | } | ||||
| return $rules; | return $rules; | ||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = array(); | ||||
| if ($this->ids) { | if ($this->ids) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'rule.id IN (%Ld)', | 'rule.id IN (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->phids) { | if ($this->phids) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'rule.phid IN (%Ls)', | 'rule.phid IN (%Ls)', | ||||
| $this->phids); | $this->phids); | ||||
| } | } | ||||
| if ($this->authorPHIDs) { | if ($this->authorPHIDs) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'rule.authorPHID IN (%Ls)', | 'rule.authorPHID IN (%Ls)', | ||||
| $this->authorPHIDs); | $this->authorPHIDs); | ||||
| } | } | ||||
| if ($this->ruleTypes) { | if ($this->ruleTypes) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'rule.ruleType IN (%Ls)', | 'rule.ruleType IN (%Ls)', | ||||
| $this->ruleTypes); | $this->ruleTypes); | ||||
| } | } | ||||
| if ($this->contentTypes) { | if ($this->contentTypes) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'rule.contentType IN (%Ls)', | 'rule.contentType IN (%Ls)', | ||||
| $this->contentTypes); | $this->contentTypes); | ||||
| } | } | ||||
| if ($this->disabled !== null) { | if ($this->disabled !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'rule.isDisabled = %d', | 'rule.isDisabled = %d', | ||||
| (int)$this->disabled); | (int)$this->disabled); | ||||
| } | } | ||||
| if ($this->datasourceQuery) { | if ($this->datasourceQuery) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'rule.name LIKE %>', | 'rule.name LIKE %>', | ||||
| $this->datasourceQuery); | $this->datasourceQuery); | ||||
| } | } | ||||
| if ($this->triggerObjectPHIDs) { | if ($this->triggerObjectPHIDs) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'rule.triggerObjectPHID IN (%Ls)', | 'rule.triggerObjectPHID IN (%Ls)', | ||||
| $this->triggerObjectPHIDs); | $this->triggerObjectPHIDs); | ||||
| } | } | ||||
| $where[] = $this->buildPagingClause($conn_r); | $where[] = $this->buildPagingClause($conn); | ||||
| return $this->formatWhereClause($where); | return $this->formatWhereClause($conn, $where); | ||||
| } | } | ||||
| private function validateRuleAuthors(array $rules) { | private function validateRuleAuthors(array $rules) { | ||||
| // "Global" and "Object" rules always have valid authors. | // "Global" and "Object" rules always have valid authors. | ||||
| foreach ($rules as $key => $rule) { | foreach ($rules as $key => $rule) { | ||||
| if ($rule->isGlobalRule() || $rule->isObjectRule()) { | if ($rule->isGlobalRule() || $rule->isObjectRule()) { | ||||
| $rule->attachValidAuthor(true); | $rule->attachValidAuthor(true); | ||||
| unset($rules[$key]); | unset($rules[$key]); | ||||
| Show All 37 Lines | |||||