Changeset View
Changeset View
Standalone View
Standalone View
src/applications/packages/query/PhabricatorPackagesPackageQuery.php
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
if ($this->packageKeys !== null) { | if ($this->packageKeys !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'p.packageKey IN (%Ls)', | 'p.packageKey IN (%Ls)', | ||||
$this->packageKeys); | $this->packageKeys); | ||||
} | } | ||||
if ($this->fullKeys !== null) { | if ($this->fullKeys !== null) { | ||||
$parts = array(); | $parts = $this->buildFullKeyClauseParts($conn, $this->fullKeys); | ||||
foreach ($this->fullKeys as $full_key) { | $where[] = qsprintf($conn, '%Q', $parts); | ||||
$key_parts = explode('/', $full_key, 2); | |||||
if (count($key_parts) != 2) { | |||||
continue; | |||||
} | |||||
$parts[] = qsprintf( | |||||
$conn, | |||||
'(u.publisherKey = %s AND p.packageKey = %s)', | |||||
$key_parts[0], | |||||
$key_parts[1]); | |||||
} | |||||
// If none of the full keys we were provided were valid, we don't | |||||
// match any results. | |||||
if (!$parts) { | |||||
throw new PhabricatorEmptyQueryException(); | |||||
} | |||||
$where[] = qsprintf( | |||||
$conn, | |||||
'%Q', | |||||
implode(' OR ', $parts)); | |||||
} | } | ||||
return $where; | return $where; | ||||
} | } | ||||
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | ||||
$joins = parent::buildJoinClauseParts($conn); | $joins = parent::buildJoinClauseParts($conn); | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |