Files
phabricator/src/applications/packages/query/PhabricatorPackagesQuery.php
epriestley 933462b487 Continue cleaning up queries in the wake of changes to "%Q"
Summary: Depends on D19810. Ref T13217. Ref T13216. I mostly used `grep implode | grep OR` and `grep implode | grep AND` to find these -- not totally exhaustive but should be a big chunk of the callsites that are missing `%LO` / `%LA`.

Test Plan:
These are tricky to test exhaustively, but I made an attempt to hit most of them:

- Browsed Almanac interfaces.
- Created/browsed Calendar events.
- Enabled/disabled/showed the lock log.
- Browsed repositories.
- Loaded Facts UI.
- Poked at Multimeter.
- Used typeahead for users and projects.
- Browsed Phriction.
- Ran various fulltext searches.

Not sure these are reachable:

- All the lint stuff might be dead/unreachable/nonfunctional?

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: yelirekim

Maniphest Tasks: T13217, T13216

Differential Revision: https://secure.phabricator.com/D19814
2018-11-16 12:49:44 -08:00

39 lines
850 B
PHP

<?php
abstract class PhabricatorPackagesQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
public function getQueryApplicationClass() {
return 'PhabricatorPackagesApplication';
}
protected function buildFullKeyClauseParts(
AphrontDatabaseConnection $conn,
array $full_keys) {
$parts = array();
foreach ($full_keys as $full_key) {
$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();
}
return qsprintf($conn, '%LO', $parts);
}
}