@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 PhabricatorManualActivitySetupCheck
4 extends PhabricatorSetupCheck {
5
6 public function getDefaultGroup() {
7 return self::GROUP_OTHER;
8 }
9
10 protected function executeChecks() {
11 $activities = id(new PhabricatorConfigManualActivity())->loadAll();
12
13 foreach ($activities as $activity) {
14 $type = $activity->getActivityType();
15
16 switch ($type) {
17 case PhabricatorConfigManualActivity::TYPE_REINDEX:
18 $this->raiseSearchReindexIssue();
19 break;
20
21 case PhabricatorConfigManualActivity::TYPE_IDENTITIES:
22 $this->raiseRebuildIdentitiesIssue();
23 break;
24
25 default:
26 }
27 }
28 }
29
30 private function raiseSearchReindexIssue() {
31 $activity_name = pht('Rebuild Search Index');
32 $activity_summary = pht(
33 'The search index algorithm has been updated and the index needs '.
34 'be rebuilt.');
35
36 $message = array();
37
38 $message[] = pht(
39 'The indexing algorithm for the fulltext search index has been '.
40 'updated and the index needs to be rebuilt. Until you rebuild the '.
41 'index, global search (and other fulltext search) will not '.
42 'function correctly.');
43
44 $message[] = pht(
45 'You can rebuild the search index while the server is running.');
46
47 $message[] = pht(
48 'To rebuild the index, run this command:');
49
50 $message[] = phutil_tag(
51 'pre',
52 array(),
53 (string)csprintf(
54 '$ ./bin/search index --all --force --background'));
55
56 $message[] = pht(
57 'You can find more information about rebuilding the search '.
58 'index here: %s',
59 phutil_tag(
60 'a',
61 array(
62 'href' => 'https://secure.phabricator.com/T11932',
63 'target' => '_blank',
64 ),
65 'https://secure.phabricator.com/T11932'));
66
67 $message[] = pht(
68 'After rebuilding the index, run this command to clear this setup '.
69 'warning:');
70
71 $message[] = phutil_tag(
72 'pre',
73 array(),
74 '$ ./bin/config done reindex');
75
76 $activity_message = phutil_implode_html("\n\n", $message);
77
78 $this->newIssue('manual.reindex')
79 ->setName($activity_name)
80 ->setSummary($activity_summary)
81 ->setMessage($activity_message);
82 }
83
84 private function raiseRebuildIdentitiesIssue() {
85 $activity_name = pht('Rebuild Repository Identities');
86 $activity_summary = pht(
87 'The mapping from VCS users to %s users has changed '.
88 'and must be rebuilt.',
89 PlatformSymbols::getPlatformServerName());
90
91 $message = array();
92
93 $message[] = pht(
94 'The way VCS activity is attributed %s user accounts has changed.',
95 PlatformSymbols::getPlatformServerName());
96
97 $message[] = pht(
98 'There is a new indirection layer between the strings that appear as '.
99 'VCS authors and committers (such as "John Developer '.
100 '<johnd@bigcorp.com>") and the user account that gets associated '.
101 'with VCS commits.');
102
103 $message[] = pht(
104 'This change supports situations where users are incorrectly '.
105 'associated with commits because the software makes a bad guess '.
106 'about how the VCS string maps to a user account. '.
107 'This also helps with situations where existing repositories are '.
108 'imported without having created accounts for all the committers to '.
109 'that repository. Until you rebuild these repository identities, you '.
110 'are likely to encounter problems with features which rely on the '.
111 'existence of these identities.');
112
113 $message[] = pht(
114 'You can rebuild repository identities while the server is running.');
115
116 $message[] = pht(
117 'To rebuild identities, run this command:');
118
119 $message[] = phutil_tag(
120 'pre',
121 array(),
122 (string)csprintf(
123 '$ ./bin/repository rebuild-identities --all-repositories'));
124
125 $message[] = pht(
126 'You can find more information about this new identity mapping '.
127 'here: %s',
128 phutil_tag(
129 'a',
130 array(
131 'href' => 'https://secure.phabricator.com/T12164',
132 'target' => '_blank',
133 ),
134 'https://secure.phabricator.com/T12164'));
135
136 $message[] = pht(
137 'After rebuilding repository identities, run this command to clear '.
138 'this setup warning:');
139
140 $message[] = phutil_tag(
141 'pre',
142 array(),
143 '$ ./bin/config done identities');
144
145 $activity_message = phutil_implode_html("\n\n", $message);
146
147 $this->newIssue('manual.identities')
148 ->setName($activity_name)
149 ->setSummary($activity_summary)
150 ->setMessage($activity_message);
151 }
152
153}