Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / diffusion / query / DiffusionPathQuery.php
blob0783643dc0938afab27598c9aaae05d4f0917221
1 <?php
3 final class DiffusionPathQuery extends Phobject {
5 private $pathIDs;
7 public function withPathIDs(array $path_ids) {
8 $this->pathIDs = $path_ids;
9 return $this;
12 public function execute() {
13 $conn = id(new PhabricatorRepository())->establishConnection('r');
15 $where = $this->buildWhereClause($conn);
17 $results = queryfx_all(
18 $conn,
19 'SELECT * FROM %T %Q',
20 PhabricatorRepository::TABLE_PATH,
21 $where);
23 return ipull($results, null, 'id');
26 protected function buildWhereClause(AphrontDatabaseConnection $conn) {
27 $where = array();
29 if ($this->pathIDs) {
30 $where[] = qsprintf(
31 $conn,
32 'id IN (%Ld)',
33 $this->pathIDs);
36 if ($where) {
37 return qsprintf($conn, 'WHERE %LA', $where);
38 } else {
39 return qsprintf($conn, '');