Detect and raise setup warnings from within Phabricator

Summary:
This is basicaly a light version of D4286. The major problem with D4286 is that it's a huge leap and completely replaces the setup process in one step.

Instead, I want to do this:

  - Add the post-setup warnings (yellow bar with "6 unresolved warnings...").
  - Copy all setup checks into post-setup warnings (so every check has an old-style check and a new-style check).
  - Run that for a little bit and make sure it's stable.
  - Implement fatal post-setup checks (the red screen, vs the yellow bar).
  - Run that for a little bit.
  - Nuke setup mode and delete all the old checks.

This should give us a bunch of very gradual steps toward the brave new world of simpler setup.

Test Plan:
 - Faked APC setup failures, saw warnings raise.
 - Verified that this runs after restart (get + set).
 - Verified that this costs us only one cache hit after first-run (get only).

Reviewers: btrahan, codeblock, vrana, chad

Reviewed By: codeblock

CC: aran

Maniphest Tasks: T2228

Differential Revision: https://secure.phabricator.com/D4295
This commit is contained in:
epriestley
2012-12-30 06:37:49 -08:00
parent ba489f9d85
commit 96839d35f4
10 changed files with 768 additions and 1 deletions

View File

@@ -0,0 +1,65 @@
<?php
final class PhabricatorConfigIssueListController
extends PhabricatorConfigController {
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$nav = $this->buildSideNavView();
$issues = PhabricatorSetupCheck::runAllChecks();
PhabricatorSetupCheck::setOpenSetupIssueCount(count($issues));
$list = $this->buildIssueList($issues);
$list->setNoDataString(pht("There are no open setup issues."));
$header = id(new PhabricatorHeaderView())
->setHeader(pht('Open Phabricator Setup Issues'));
$nav->appendChild(
array(
$header,
$list,
));
$title = pht('Setup Issues');
$crumbs = $this
->buildApplicationCrumbs($nav)
->addCrumb(
id(new PhabricatorCrumbView())
->setName($title)
->setHref($this->getApplicationURI('issue/')));
$nav->setCrumbs($crumbs);
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
'device' => true,
)
);
}
private function buildIssueList(array $issues) {
assert_instances_of($issues, 'PhabricatorSetupIssue');
$list = new PhabricatorObjectItemListView();
foreach ($issues as $issue) {
$href = $this->getApplicationURI('/issue/'.$issue->getIssueKey().'/');
$item = id(new PhabricatorObjectItemView())
->setHeader($issue->getName())
->setHref($href)
->setBarColor('yellow')
->addIcon('warning', pht('Setup Warning'))
->addAttribute($issue->getSummary());
$list->addItem($item);
}
return $list;
}
}