Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/query/DiffusionPathQuery.php
12242 views
1
<?php
2
3
final class DiffusionPathQuery extends Phobject {
4
5
private $pathIDs;
6
7
public function withPathIDs(array $path_ids) {
8
$this->pathIDs = $path_ids;
9
return $this;
10
}
11
12
public function execute() {
13
$conn = id(new PhabricatorRepository())->establishConnection('r');
14
15
$where = $this->buildWhereClause($conn);
16
17
$results = queryfx_all(
18
$conn,
19
'SELECT * FROM %T %Q',
20
PhabricatorRepository::TABLE_PATH,
21
$where);
22
23
return ipull($results, null, 'id');
24
}
25
26
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
27
$where = array();
28
29
if ($this->pathIDs) {
30
$where[] = qsprintf(
31
$conn,
32
'id IN (%Ld)',
33
$this->pathIDs);
34
}
35
36
if ($where) {
37
return qsprintf($conn, 'WHERE %LA', $where);
38
} else {
39
return qsprintf($conn, '');
40
}
41
}
42
43
}
44
45