@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final 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}