1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +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 {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() {
if (!extension_loaded('apc')) {
$message = pht(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,18 +14,49 @@ final class PhabricatorConfigIssueListController
PhabricatorSetupCheck::setOpenSetupIssueCount(
PhabricatorSetupCheck::countUnignoredIssues($issues));
$list = $this->buildIssueList($issues);
$list->setNoDataString(pht('There are no open setup issues.'));
$list->setStackable(true);
$important = $this->buildIssueList(
$issues, PhabricatorSetupCheck::GROUP_IMPORTANT);
$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())
->setHeaderText(pht('Open Phabricator Setup Issues'))
->appendChild($list);
$setup_issues = array();
if ($important) {
$setup_issues[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Important Setup Issues'))
->appendChild($important);
}
$nav->appendChild(
array(
$box,
));
if ($php) {
$setup_issues[] = id(new PHUIObjectBoxView())
->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');
@ -42,25 +73,30 @@ final class PhabricatorConfigIssueListController
));
}
private function buildIssueList(array $issues) {
private function buildIssueList(array $issues, $group) {
assert_instances_of($issues, 'PhabricatorSetupIssue');
$list = new PHUIObjectItemListView();
$list->setStackable(true);
$ignored_items = array();
$items = 0;
foreach ($issues as $issue) {
if ($issue->getGroup() == $group) {
$items++;
$href = $this->getApplicationURI('/issue/'.$issue->getIssueKey().'/');
$item = id(new PHUIObjectItemView())
->setHeader($issue->getName())
->setHref($href)
->addAttribute($issue->getSummary());
if (!$issue->getIsIgnored()) {
$item->setBarColor('yellow');
$list->addItem($item);
} else {
$item->addIcon('fa-eye-slash', pht('Ignored'));
$item->setDisabled(true);
$item->setBarColor('none');
$ignored_items[] = $item;
if (!$issue->getIsIgnored()) {
$item->setBarColor('yellow');
$list->addItem($item);
} else {
$item->addIcon('fa-eye-slash', pht('Ignored'));
$item->setDisabled(true);
$item->setBarColor('none');
$ignored_items[] = $item;
}
}
}
@ -68,7 +104,11 @@ final class PhabricatorConfigIssueListController
$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 $summary;
private $shortName;
private $group;
private $isIgnored = false;
private $phpExtensions = array();
@ -40,6 +41,19 @@ final class PhabricatorSetupIssue {
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) {
$this->name = $name;
return $this;