Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | $data = queryfx_all( | ||||
$table->getTableName(), | $table->getTableName(), | ||||
$this->buildWhereClause($conn_r), | $this->buildWhereClause($conn_r), | ||||
$this->buildOrderClause($conn_r), | $this->buildOrderClause($conn_r), | ||||
$this->buildLimitClause($conn_r)); | $this->buildLimitClause($conn_r)); | ||||
return $table->loadAllFromArray($data); | return $table->loadAllFromArray($data); | ||||
} | } | ||||
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
$where = array(); | $where = array(); | ||||
if ($this->ids) { | if ($this->ids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'id IN (%Ld)', | 'id IN (%Ld)', | ||||
$this->ids); | $this->ids); | ||||
} | } | ||||
if ($this->phids) { | if ($this->phids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'phid IN (%Ls)', | 'phid IN (%Ls)', | ||||
$this->phids); | $this->phids); | ||||
} | } | ||||
if ($this->providerClasses) { | if ($this->providerClasses !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'providerClass IN (%Ls)', | 'providerClass IN (%Ls)', | ||||
$this->providerClasses); | $this->providerClasses); | ||||
} | } | ||||
$status = $this->status; | $status = $this->status; | ||||
switch ($status) { | switch ($status) { | ||||
case self::STATUS_ALL: | case self::STATUS_ALL: | ||||
break; | break; | ||||
case self::STATUS_ENABLED: | case self::STATUS_ENABLED: | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'isEnabled = 1'); | 'isEnabled = 1'); | ||||
break; | break; | ||||
default: | default: | ||||
throw new Exception(pht("Unknown status '%s'!", $status)); | throw new Exception(pht("Unknown status '%s'!", $status)); | ||||
} | } | ||||
$where[] = $this->buildPagingClause($conn_r); | $where[] = $this->buildPagingClause($conn); | ||||
return $this->formatWhereClause($where); | return $this->formatWhereClause($conn, $where); | ||||
} | } | ||||
public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
return 'PhabricatorAuthApplication'; | return 'PhabricatorAuthApplication'; | ||||
} | } | ||||
} | } |