@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 PhabricatorIDsSearchEngineExtension
4 extends PhabricatorSearchEngineExtension {
5
6 const EXTENSIONKEY = 'ids';
7
8 public function isExtensionEnabled() {
9 return true;
10 }
11
12 public function getExtensionName() {
13 return pht('Supports ID/PHID Queries');
14 }
15
16 public function getExtensionOrder() {
17 return 1000;
18 }
19
20 public function supportsObject($object) {
21 return true;
22 }
23
24 public function getSearchFields($object) {
25 return array(
26 id(new PhabricatorIDsSearchField())
27 ->setKey('ids')
28 ->setLabel(pht('IDs'))
29 ->setDescription(
30 pht('Search for objects with specific IDs.')),
31 id(new PhabricatorPHIDsSearchField())
32 ->setKey('phids')
33 ->setLabel(pht('PHIDs'))
34 ->setDescription(
35 pht('Search for objects with specific PHIDs.')),
36 );
37 }
38
39 public function applyConstraintsToQuery(
40 $object,
41 $query,
42 PhabricatorSavedQuery $saved,
43 array $map) {
44
45 if ($map['ids']) {
46 $query->withIDs($map['ids']);
47 }
48
49 if ($map['phids']) {
50 $query->withPHIDs($map['phids']);
51 }
52
53 }
54
55}