@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 DiffusionRepositoryURIsIndexEngineExtension
4 extends PhabricatorIndexEngineExtension {
5
6 const EXTENSIONKEY = 'diffusion.repositories.uri';
7
8 public function getExtensionName() {
9 return pht('Repository URIs');
10 }
11
12 public function shouldIndexObject($object) {
13 return ($object instanceof PhabricatorRepository);
14 }
15
16 public function indexObject(
17 PhabricatorIndexEngine $engine,
18 $object) {
19
20 // Reload the repository to pick up URIs, which we need in order to update
21 // the URI index.
22 $object = id(new PhabricatorRepositoryQuery())
23 ->setViewer(PhabricatorUser::getOmnipotentUser())
24 ->withPHIDs(array($object->getPHID()))
25 ->needURIs(true)
26 ->executeOne();
27 if (!$object) {
28 return;
29 }
30
31 $object->updateURIIndex();
32 }
33
34}