Remove product literal strings in "pht()", part 5
[phabricator.git] / src / applications / guides / module / PhabricatorGuideInstallModule.php
blob2299bce2601462267cc57eb426036d9cb46f1b2e
1 <?php
3 final class PhabricatorGuideInstallModule extends PhabricatorGuideModule {
5 public function getModuleKey() {
6 return 'install';
9 public function getModuleName() {
10 return pht('Install');
13 public function getModulePosition() {
14 return 20;
17 public function getIsModuleEnabled() {
18 if (PhabricatorEnv::getEnvConfig('cluster.instance')) {
19 return false;
21 return true;
24 public function renderModuleStatus(AphrontRequest $request) {
25 $viewer = $request->getViewer();
27 $guide_items = new PhabricatorGuideListView();
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.');
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);
52 $configs = id(new PhabricatorAuthProviderConfigQuery())
53 ->setViewer(PhabricatorUser::getOmnipotentUser())
54 ->execute();
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.');
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);
81 $title = pht('Configure');
82 $href = PhabricatorEnv::getURI('/config/');
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');
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.');
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);
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();
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');
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);
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.');
154 $item = id(new PhabricatorGuideItemView())
155 ->setTitle($title)
156 ->setHref($href)
157 ->setIcon($icon)
158 ->setIconBackground($icon_bg)
159 ->setDescription($description);
161 $guide_items->addItem($item);
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());
171 $intro = new PHUIRemarkupView($viewer, $intro);
173 $intro = id(new PHUIDocumentView())
174 ->appendChild($intro);
176 return array($intro, $guide_items);