@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
3/**
4 * @extends PhabricatorCursorPagedPolicyAwareQuery<PhabricatorConfigEntry>
5 */
6final class PhabricatorConfigEntryQuery
7 extends PhabricatorCursorPagedPolicyAwareQuery {
8
9 private $phids;
10 private $ids;
11
12 public function withIDs($ids) {
13 $this->ids = $ids;
14 return $this;
15 }
16
17 public function withPHIDs($phids) {
18 $this->phids = $phids;
19 return $this;
20 }
21
22 protected function loadPage() {
23 $table = new PhabricatorConfigEntry();
24 $conn_r = $table->establishConnection('r');
25
26 $data = queryfx_all(
27 $conn_r,
28 'SELECT * FROM %T %Q %Q %Q',
29 $table->getTableName(),
30 $this->buildWhereClause($conn_r),
31 $this->buildOrderClause($conn_r),
32 $this->buildLimitClause($conn_r));
33
34 return $table->loadAllFromArray($data);
35 }
36
37 protected function buildWhereClause(AphrontDatabaseConnection $conn) {
38 $where = array();
39
40 if ($this->ids !== null) {
41 $where[] = qsprintf(
42 $conn,
43 'id IN (%Ld)',
44 $this->ids);
45 }
46
47 if ($this->phids !== null) {
48 $where[] = qsprintf(
49 $conn,
50 'phid IN (%Ls)',
51 $this->phids);
52 }
53
54 $where[] = $this->buildPagingClause($conn);
55
56 return $this->formatWhereClause($conn, $where);
57 }
58
59 public function getQueryApplicationClass() {
60 return PhabricatorConfigApplication::class;
61 }
62
63}