1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-03 11:21:01 +01:00

Split Setup Issues into Groups

Summary: Groups setup issues into Important, PHP, MySQL, and Base for easier parsing on initial installations.

Test Plan:
Test my internal server and various issues.

{F289699}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7207

Differential Revision: https://secure.phabricator.com/D11726
This commit is contained in:
Chad Little 2015-02-10 12:53:00 -08:00
parent 91a1f56a4c
commit b701313e0e
25 changed files with 167 additions and 20 deletions

View file

@ -2,6 +2,10 @@
final class PhabricatorAPCSetupCheck extends PhabricatorSetupCheck { final class PhabricatorAPCSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
if (!extension_loaded('apc')) { if (!extension_loaded('apc')) {
$message = pht( $message = pht(

View file

@ -2,6 +2,10 @@
final class PhabricatorAuthSetupCheck extends PhabricatorSetupCheck { final class PhabricatorAuthSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_IMPORTANT;
}
protected function executeChecks() { protected function executeChecks() {
// NOTE: We're not actually building these providers. Building providers // NOTE: We're not actually building these providers. Building providers
// can require additional configuration to be present (e.g., to build // can require additional configuration to be present (e.g., to build

View file

@ -2,6 +2,10 @@
final class PhabricatorBaseURISetupCheck extends PhabricatorSetupCheck { final class PhabricatorBaseURISetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_IMPORTANT;
}
protected function executeChecks() { protected function executeChecks() {
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');

View file

@ -2,6 +2,9 @@
final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck { final class PhabricatorBinariesSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {

View file

@ -2,6 +2,10 @@
final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck { final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_IMPORTANT;
}
protected function executeChecks() { protected function executeChecks() {
$task_daemon = id(new PhabricatorDaemonLogQuery()) $task_daemon = id(new PhabricatorDaemonLogQuery())

View file

@ -2,6 +2,10 @@
final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck { final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_IMPORTANT;
}
public function getExecutionOrder() { public function getExecutionOrder() {
// This must run after basic PHP checks, but before most other checks. // This must run after basic PHP checks, but before most other checks.
return 0.5; return 0.5;

View file

@ -2,6 +2,10 @@
final class PhabricatorElasticSetupCheck extends PhabricatorSetupCheck { final class PhabricatorElasticSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
if (PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) { if (PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) {
$engine = PhabricatorSearchEngineSelector::newSelector()->newEngine(); $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine();

View file

@ -2,6 +2,10 @@
final class PhabricatorExtensionsSetupCheck extends PhabricatorSetupCheck { final class PhabricatorExtensionsSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_PHP;
}
public function getExecutionOrder() { public function getExecutionOrder() {
return 0; return 0;
} }

View file

@ -2,6 +2,10 @@
final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck { final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
$ancient_config = self::getAncientConfig(); $ancient_config = self::getAncientConfig();

View file

@ -2,6 +2,10 @@
final class PhabricatorFileinfoSetupCheck extends PhabricatorSetupCheck { final class PhabricatorFileinfoSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
if (!extension_loaded('fileinfo')) { if (!extension_loaded('fileinfo')) {
$message = pht( $message = pht(

View file

@ -2,6 +2,10 @@
final class PhabricatorGDSetupCheck extends PhabricatorSetupCheck { final class PhabricatorGDSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
if (!extension_loaded('gd')) { if (!extension_loaded('gd')) {
$message = pht( $message = pht(

View file

@ -2,6 +2,10 @@
final class PhabricatorImagemagickSetupCheck extends PhabricatorSetupCheck { final class PhabricatorImagemagickSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
$imagemagick = PhabricatorEnv::getEnvConfig('files.enable-imagemagick'); $imagemagick = PhabricatorEnv::getEnvConfig('files.enable-imagemagick');
if ($imagemagick) { if ($imagemagick) {

View file

@ -2,6 +2,10 @@
final class PhabricatorInvalidConfigSetupCheck extends PhabricatorSetupCheck { final class PhabricatorInvalidConfigSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
$groups = PhabricatorApplicationConfigOptions::loadAll(); $groups = PhabricatorApplicationConfigOptions::loadAll();
foreach ($groups as $group) { foreach ($groups as $group) {

View file

@ -2,6 +2,10 @@
final class PhabricatorMailSetupCheck extends PhabricatorSetupCheck { final class PhabricatorMailSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
$adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter'); $adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter');

View file

@ -2,6 +2,10 @@
final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck { final class PhabricatorMySQLSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_MYSQL;
}
public static function loadRawConfigValue($key) { public static function loadRawConfigValue($key) {
$conn_raw = id(new PhabricatorUser())->establishConnection('w'); $conn_raw = id(new PhabricatorUser())->establishConnection('w');

View file

@ -2,6 +2,10 @@
final class PhabricatorPHPConfigSetupCheck extends PhabricatorSetupCheck { final class PhabricatorPHPConfigSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_PHP;
}
public function getExecutionOrder() { public function getExecutionOrder() {
return 0; return 0;
} }

View file

@ -2,6 +2,10 @@
final class PhabricatorPathSetupCheck extends PhabricatorSetupCheck { final class PhabricatorPathSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
// NOTE: We've already appended `environment.append-paths`, so we don't // NOTE: We've already appended `environment.append-paths`, so we don't
// need to explicitly check for it. // need to explicitly check for it.

View file

@ -2,6 +2,10 @@
final class PhabricatorPygmentSetupCheck extends PhabricatorSetupCheck { final class PhabricatorPygmentSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
$pygment = PhabricatorEnv::getEnvConfig('pygments.enabled'); $pygment = PhabricatorEnv::getEnvConfig('pygments.enabled');

View file

@ -2,6 +2,10 @@
final class PhabricatorRepositoriesSetupCheck extends PhabricatorSetupCheck { final class PhabricatorRepositoriesSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
$cluster_services = id(new AlmanacServiceQuery()) $cluster_services = id(new AlmanacServiceQuery())

View file

@ -2,6 +2,10 @@
final class PhabricatorSecuritySetupCheck extends PhabricatorSetupCheck { final class PhabricatorSecuritySetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
// This checks for a version of bash with the "Shellshock" vulnerability. // This checks for a version of bash with the "Shellshock" vulnerability.

View file

@ -6,6 +6,11 @@ abstract class PhabricatorSetupCheck {
abstract protected function executeChecks(); abstract protected function executeChecks();
const GROUP_OTHER = 'other';
const GROUP_MYSQL = 'mysql';
const GROUP_PHP = 'php';
const GROUP_IMPORTANT = 'important';
public function getExecutionOrder() { public function getExecutionOrder() {
return 1; return 1;
} }
@ -14,6 +19,7 @@ abstract class PhabricatorSetupCheck {
$issue = id(new PhabricatorSetupIssue()) $issue = id(new PhabricatorSetupIssue())
->setIssueKey($key); ->setIssueKey($key);
$this->issues[$key] = $issue; $this->issues[$key] = $issue;
$issue->setGroup($this->getDefaultGroup());
return $issue; return $issue;
} }

View file

@ -2,6 +2,10 @@
final class PhabricatorStorageSetupCheck extends PhabricatorSetupCheck { final class PhabricatorStorageSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
/** /**
* @phutil-external-symbol class PhabricatorStartup * @phutil-external-symbol class PhabricatorStartup
*/ */

View file

@ -2,6 +2,10 @@
final class PhabricatorTimezoneSetupCheck extends PhabricatorSetupCheck { final class PhabricatorTimezoneSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() { protected function executeChecks() {
$php_value = ini_get('date.timezone'); $php_value = ini_get('date.timezone');
if ($php_value) { if ($php_value) {

View file

@ -14,18 +14,49 @@ final class PhabricatorConfigIssueListController
PhabricatorSetupCheck::setOpenSetupIssueCount( PhabricatorSetupCheck::setOpenSetupIssueCount(
PhabricatorSetupCheck::countUnignoredIssues($issues)); PhabricatorSetupCheck::countUnignoredIssues($issues));
$list = $this->buildIssueList($issues); $important = $this->buildIssueList(
$list->setNoDataString(pht('There are no open setup issues.')); $issues, PhabricatorSetupCheck::GROUP_IMPORTANT);
$list->setStackable(true); $php = $this->buildIssueList(
$issues, PhabricatorSetupCheck::GROUP_PHP);
$mysql = $this->buildIssueList(
$issues, PhabricatorSetupCheck::GROUP_MYSQL);
$other = $this->buildIssueList(
$issues, PhabricatorSetupCheck::GROUP_OTHER);
$box = id(new PHUIObjectBoxView()) $setup_issues = array();
->setHeaderText(pht('Open Phabricator Setup Issues')) if ($important) {
->appendChild($list); $setup_issues[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Important Setup Issues'))
->appendChild($important);
}
$nav->appendChild( if ($php) {
array( $setup_issues[] = id(new PHUIObjectBoxView())
$box, ->setHeaderText(pht('PHP Setup Issues'))
)); ->appendChild($php);
}
if ($mysql) {
$setup_issues[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('MySQL Setup Issues'))
->appendChild($mysql);
}
if ($other) {
$setup_issues[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Other Setup Issues'))
->appendChild($other);
}
if (empty($setup_issues)) {
$setup_issues[] = id(new PHUIErrorView())
->setTitle(pht('No Issues'))
->appendChild(
pht('Your install has no current setup issues to resolve.'))
->setSeverity(PHUIErrorView::SEVERITY_NOTICE);
}
$nav->appendChild($setup_issues);
$title = pht('Setup Issues'); $title = pht('Setup Issues');
@ -42,25 +73,30 @@ final class PhabricatorConfigIssueListController
)); ));
} }
private function buildIssueList(array $issues) { private function buildIssueList(array $issues, $group) {
assert_instances_of($issues, 'PhabricatorSetupIssue'); assert_instances_of($issues, 'PhabricatorSetupIssue');
$list = new PHUIObjectItemListView(); $list = new PHUIObjectItemListView();
$list->setStackable(true);
$ignored_items = array(); $ignored_items = array();
$items = 0;
foreach ($issues as $issue) { foreach ($issues as $issue) {
if ($issue->getGroup() == $group) {
$items++;
$href = $this->getApplicationURI('/issue/'.$issue->getIssueKey().'/'); $href = $this->getApplicationURI('/issue/'.$issue->getIssueKey().'/');
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
->setHeader($issue->getName()) ->setHeader($issue->getName())
->setHref($href) ->setHref($href)
->addAttribute($issue->getSummary()); ->addAttribute($issue->getSummary());
if (!$issue->getIsIgnored()) { if (!$issue->getIsIgnored()) {
$item->setBarColor('yellow'); $item->setBarColor('yellow');
$list->addItem($item); $list->addItem($item);
} else { } else {
$item->addIcon('fa-eye-slash', pht('Ignored')); $item->addIcon('fa-eye-slash', pht('Ignored'));
$item->setDisabled(true); $item->setDisabled(true);
$item->setBarColor('none'); $item->setBarColor('none');
$ignored_items[] = $item; $ignored_items[] = $item;
}
} }
} }
@ -68,7 +104,11 @@ final class PhabricatorConfigIssueListController
$list->addItem($item); $list->addItem($item);
} }
return $list; if ($items == 0) {
return null;
} else {
return $list;
}
} }
} }

View file

@ -8,6 +8,7 @@ final class PhabricatorSetupIssue {
private $isFatal; private $isFatal;
private $summary; private $summary;
private $shortName; private $shortName;
private $group;
private $isIgnored = false; private $isIgnored = false;
private $phpExtensions = array(); private $phpExtensions = array();
@ -40,6 +41,19 @@ final class PhabricatorSetupIssue {
return $this->shortName; return $this->shortName;
} }
public function setGroup($group) {
$this->group = $group;
return $this;
}
public function getGroup() {
if ($this->group) {
return $this->group;
} else {
return PhabricatorSetupCheck::GROUP_OTHER;
}
}
public function setName($name) { public function setName($name) {
$this->name = $name; $this->name = $name;
return $this; return $this;