Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/guides/module/PhabricatorGuideInstallModule.php
12242 views
1
<?php
2
3
final class PhabricatorGuideInstallModule extends PhabricatorGuideModule {
4
5
public function getModuleKey() {
6
return 'install';
7
}
8
9
public function getModuleName() {
10
return pht('Install');
11
}
12
13
public function getModulePosition() {
14
return 20;
15
}
16
17
public function getIsModuleEnabled() {
18
if (PhabricatorEnv::getEnvConfig('cluster.instance')) {
19
return false;
20
}
21
return true;
22
}
23
24
public function renderModuleStatus(AphrontRequest $request) {
25
$viewer = $request->getViewer();
26
27
$guide_items = new PhabricatorGuideListView();
28
29
$title = pht('Resolve Setup Issues');
30
$issues_resolved = !PhabricatorSetupCheck::getOpenSetupIssueKeys();
31
$href = PhabricatorEnv::getURI('/config/issue/');
32
if ($issues_resolved) {
33
$icon = 'fa-check';
34
$icon_bg = 'bg-green';
35
$description = pht(
36
"You've resolved (or ignored) all outstanding setup issues.");
37
} else {
38
$icon = 'fa-warning';
39
$icon_bg = 'bg-red';
40
$description =
41
pht('You have some unresolved setup issues to take care of.');
42
}
43
44
$item = id(new PhabricatorGuideItemView())
45
->setTitle($title)
46
->setHref($href)
47
->setIcon($icon)
48
->setIconBackground($icon_bg)
49
->setDescription($description);
50
$guide_items->addItem($item);
51
52
$configs = id(new PhabricatorAuthProviderConfigQuery())
53
->setViewer(PhabricatorUser::getOmnipotentUser())
54
->execute();
55
56
$title = pht('Login and Registration');
57
$href = PhabricatorEnv::getURI('/auth/');
58
$have_auth = (bool)$configs;
59
if ($have_auth) {
60
$icon = 'fa-check';
61
$icon_bg = 'bg-green';
62
$description = pht(
63
"You've configured at least one authentication provider.");
64
} else {
65
$icon = 'fa-key';
66
$icon_bg = 'bg-sky';
67
$description = pht(
68
'Authentication providers allow users to register accounts and '.
69
'log in.');
70
}
71
72
$item = id(new PhabricatorGuideItemView())
73
->setTitle($title)
74
->setHref($href)
75
->setIcon($icon)
76
->setIconBackground($icon_bg)
77
->setDescription($description);
78
$guide_items->addItem($item);
79
80
81
$title = pht('Configure');
82
$href = PhabricatorEnv::getURI('/config/');
83
84
// Just load any config value at all; if one exists the install has figured
85
// out how to configure things.
86
$have_config = (bool)id(new PhabricatorConfigEntry())->loadAllWhere(
87
'1 = 1 LIMIT 1');
88
89
if ($have_config) {
90
$icon = 'fa-check';
91
$icon_bg = 'bg-green';
92
$description = pht(
93
"You've configured at least one setting from the web interface.");
94
} else {
95
$icon = 'fa-sliders';
96
$icon_bg = 'bg-sky';
97
$description = pht(
98
'Learn how to configure mail and other options.');
99
}
100
101
$item = id(new PhabricatorGuideItemView())
102
->setTitle($title)
103
->setHref($href)
104
->setIcon($icon)
105
->setIconBackground($icon_bg)
106
->setDescription($description);
107
$guide_items->addItem($item);
108
109
110
$title = pht('User Account Settings');
111
$href = PhabricatorEnv::getURI('/settings/');
112
$preferences = id(new PhabricatorUserPreferencesQuery())
113
->setViewer($viewer)
114
->withUsers(array($viewer))
115
->executeOne();
116
117
$have_settings = ($preferences && $preferences->getPreferences());
118
if ($have_settings) {
119
$icon = 'fa-check';
120
$icon_bg = 'bg-green';
121
$description = pht(
122
"You've adjusted at least one setting on your account.");
123
} else {
124
$icon = 'fa-wrench';
125
$icon_bg = 'bg-sky';
126
$description = pht(
127
'Configure account settings for all users, or just yourself');
128
}
129
130
$item = id(new PhabricatorGuideItemView())
131
->setTitle($title)
132
->setHref($href)
133
->setIcon($icon)
134
->setIconBackground($icon_bg)
135
->setDescription($description);
136
$guide_items->addItem($item);
137
138
139
$title = pht('Notification Server');
140
$href = PhabricatorEnv::getURI('/config/edit/notification.servers/');
141
$have_notifications = PhabricatorEnv::getEnvConfig('notification.servers');
142
if ($have_notifications) {
143
$icon = 'fa-check';
144
$icon_bg = 'bg-green';
145
$description = pht(
146
"You've set up a real-time notification server.");
147
} else {
148
$icon = 'fa-bell';
149
$icon_bg = 'bg-sky';
150
$description = pht(
151
'Real-time notifications can be delivered with WebSockets.');
152
}
153
154
$item = id(new PhabricatorGuideItemView())
155
->setTitle($title)
156
->setHref($href)
157
->setIcon($icon)
158
->setIconBackground($icon_bg)
159
->setDescription($description);
160
161
$guide_items->addItem($item);
162
163
$intro = pht(
164
'%s has been successfully installed. These next guides will '.
165
'take you through configuration and new user orientation. '.
166
'These steps are optional, and you can go through them in any order. '.
167
'If you want to get back to this guide later on, you can find it in '.
168
'{icon globe} **Applications** under {icon map-o} **Guides**.',
169
PlatformSymbols::getPlatformServerName());
170
171
$intro = new PHUIRemarkupView($viewer, $intro);
172
173
$intro = id(new PHUIDocumentView())
174
->appendChild($intro);
175
176
return array($intro, $guide_items);
177
178
}
179
180
}
181
182