Path: blob/master/src/applications/guides/module/PhabricatorGuideInstallModule.php
12242 views
<?php12final class PhabricatorGuideInstallModule extends PhabricatorGuideModule {34public function getModuleKey() {5return 'install';6}78public function getModuleName() {9return pht('Install');10}1112public function getModulePosition() {13return 20;14}1516public function getIsModuleEnabled() {17if (PhabricatorEnv::getEnvConfig('cluster.instance')) {18return false;19}20return true;21}2223public function renderModuleStatus(AphrontRequest $request) {24$viewer = $request->getViewer();2526$guide_items = new PhabricatorGuideListView();2728$title = pht('Resolve Setup Issues');29$issues_resolved = !PhabricatorSetupCheck::getOpenSetupIssueKeys();30$href = PhabricatorEnv::getURI('/config/issue/');31if ($issues_resolved) {32$icon = 'fa-check';33$icon_bg = 'bg-green';34$description = pht(35"You've resolved (or ignored) all outstanding setup issues.");36} else {37$icon = 'fa-warning';38$icon_bg = 'bg-red';39$description =40pht('You have some unresolved setup issues to take care of.');41}4243$item = id(new PhabricatorGuideItemView())44->setTitle($title)45->setHref($href)46->setIcon($icon)47->setIconBackground($icon_bg)48->setDescription($description);49$guide_items->addItem($item);5051$configs = id(new PhabricatorAuthProviderConfigQuery())52->setViewer(PhabricatorUser::getOmnipotentUser())53->execute();5455$title = pht('Login and Registration');56$href = PhabricatorEnv::getURI('/auth/');57$have_auth = (bool)$configs;58if ($have_auth) {59$icon = 'fa-check';60$icon_bg = 'bg-green';61$description = pht(62"You've configured at least one authentication provider.");63} else {64$icon = 'fa-key';65$icon_bg = 'bg-sky';66$description = pht(67'Authentication providers allow users to register accounts and '.68'log in.');69}7071$item = id(new PhabricatorGuideItemView())72->setTitle($title)73->setHref($href)74->setIcon($icon)75->setIconBackground($icon_bg)76->setDescription($description);77$guide_items->addItem($item);787980$title = pht('Configure');81$href = PhabricatorEnv::getURI('/config/');8283// Just load any config value at all; if one exists the install has figured84// out how to configure things.85$have_config = (bool)id(new PhabricatorConfigEntry())->loadAllWhere(86'1 = 1 LIMIT 1');8788if ($have_config) {89$icon = 'fa-check';90$icon_bg = 'bg-green';91$description = pht(92"You've configured at least one setting from the web interface.");93} else {94$icon = 'fa-sliders';95$icon_bg = 'bg-sky';96$description = pht(97'Learn how to configure mail and other options.');98}99100$item = id(new PhabricatorGuideItemView())101->setTitle($title)102->setHref($href)103->setIcon($icon)104->setIconBackground($icon_bg)105->setDescription($description);106$guide_items->addItem($item);107108109$title = pht('User Account Settings');110$href = PhabricatorEnv::getURI('/settings/');111$preferences = id(new PhabricatorUserPreferencesQuery())112->setViewer($viewer)113->withUsers(array($viewer))114->executeOne();115116$have_settings = ($preferences && $preferences->getPreferences());117if ($have_settings) {118$icon = 'fa-check';119$icon_bg = 'bg-green';120$description = pht(121"You've adjusted at least one setting on your account.");122} else {123$icon = 'fa-wrench';124$icon_bg = 'bg-sky';125$description = pht(126'Configure account settings for all users, or just yourself');127}128129$item = id(new PhabricatorGuideItemView())130->setTitle($title)131->setHref($href)132->setIcon($icon)133->setIconBackground($icon_bg)134->setDescription($description);135$guide_items->addItem($item);136137138$title = pht('Notification Server');139$href = PhabricatorEnv::getURI('/config/edit/notification.servers/');140$have_notifications = PhabricatorEnv::getEnvConfig('notification.servers');141if ($have_notifications) {142$icon = 'fa-check';143$icon_bg = 'bg-green';144$description = pht(145"You've set up a real-time notification server.");146} else {147$icon = 'fa-bell';148$icon_bg = 'bg-sky';149$description = pht(150'Real-time notifications can be delivered with WebSockets.');151}152153$item = id(new PhabricatorGuideItemView())154->setTitle($title)155->setHref($href)156->setIcon($icon)157->setIconBackground($icon_bg)158->setDescription($description);159160$guide_items->addItem($item);161162$intro = pht(163'%s has been successfully installed. These next guides will '.164'take you through configuration and new user orientation. '.165'These steps are optional, and you can go through them in any order. '.166'If you want to get back to this guide later on, you can find it in '.167'{icon globe} **Applications** under {icon map-o} **Guides**.',168PlatformSymbols::getPlatformServerName());169170$intro = new PHUIRemarkupView($viewer, $intro);171172$intro = id(new PHUIDocumentView())173->appendChild($intro);174175return array($intro, $guide_items);176177}178179}180181182