@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// Advise installs to perform a reindex in order to rebuild the Ferret engine
4// indexes.
5
6// If the install is completely empty with no user accounts, don't require
7// a rebuild. In particular, this happens when rebuilding the quickstart file.
8$users = id(new PhabricatorUser())->loadAllWhere('1 = 1 LIMIT 1');
9if (!$users) {
10 return;
11}
12
13try {
14 id(new PhabricatorConfigManualActivity())
15 ->setActivityType(PhabricatorConfigManualActivity::TYPE_REINDEX)
16 ->save();
17} catch (AphrontDuplicateKeyQueryException $ex) {
18 // If we've already noted that this activity is required, just move on.
19}