1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Config option to ignore setup issues

Summary: T2381

Test Plan:
Include existing setup issues in the ignore config option,
reduces the number of setup issues in the status bar, moves ignored
issues to the bottom of the list, and marks them as ignored.

Also include a string corresponding to no setup issue, and verify that
application does not break.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5072
This commit is contained in:
Nick Pellegrino 2013-02-22 09:21:01 -08:00 committed by epriestley
parent 894cd13a41
commit be7677f211
6 changed files with 55 additions and 11 deletions

View file

@ -154,6 +154,9 @@ return array(
// Map of additional configuration values to mask.
'config.mask' => array(),
// Ignore setup warnings of the following issues.
'config.ignore-issues' => array(),
// -- MySQL --------------------------------------------------------------- //
// Class providing database configuration. It must implement

View file

@ -13,7 +13,6 @@ abstract class PhabricatorSetupCheck {
final protected function newIssue($key) {
$issue = id(new PhabricatorSetupIssue())
->setIssueKey($key);
$this->issues[$key] = $issue;
return $issue;
@ -38,6 +37,17 @@ abstract class PhabricatorSetupCheck {
$cache->setKey('phabricator.setup.issues', $count);
}
final public static function countUnignoredIssues(array $all_issues) {
assert_instances_of($all_issues, 'PhabricatorSetupIssue');
$count = 0;
foreach ($all_issues as $issue) {
if (!$issue->getIsIgnored()) {
$count++;
}
}
return $count;
}
final public static function getConfigNeedsRepair() {
$cache = PhabricatorCaches::getSetupCache();
return $cache->getKey('phabricator.setup.needs-repair');
@ -69,7 +79,7 @@ abstract class PhabricatorSetupCheck {
->setView($view);
}
}
self::setOpenSetupIssueCount(count($issues));
self::setOpenSetupIssueCount(self::countUnignoredIssues($issues));
}
// Try to repair configuration unless we have a clean bill of health on it.
@ -111,6 +121,13 @@ abstract class PhabricatorSetupCheck {
}
}
foreach (PhabricatorEnv::getEnvConfig('config.ignore-issues')
as $ignorable => $derp) {
if (isset($issues[$ignorable])) {
$issues[$ignorable]->setIsIgnored(true);
}
}
return $issues;
}

View file

@ -11,7 +11,8 @@ final class PhabricatorConfigIssueListController
$nav->selectFilter('issue/');
$issues = PhabricatorSetupCheck::runAllChecks();
PhabricatorSetupCheck::setOpenSetupIssueCount(count($issues));
PhabricatorSetupCheck::setOpenSetupIssueCount(
PhabricatorSetupCheck::countUnignoredIssues($issues));
$list = $this->buildIssueList($issues);
$list->setNoDataString(pht("There are no open setup issues."));
@ -48,6 +49,7 @@ final class PhabricatorConfigIssueListController
assert_instances_of($issues, 'PhabricatorSetupIssue');
$list = new PhabricatorObjectItemListView();
$list->setStackable();
$ignored_items = array();
foreach ($issues as $issue) {
$href = $this->getApplicationURI('/issue/'.$issue->getIssueKey().'/');
@ -55,8 +57,17 @@ final class PhabricatorConfigIssueListController
->setHeader($issue->getName())
->setHref($href)
->setBarColor('yellow')
->addIcon('warning', pht('Setup Warning'))
->addAttribute($issue->getSummary());
if (!$issue->getIsIgnored()) {
$item->addIcon('warning', pht('Setup Warning'));
$list->addItem($item);
} else {
$item->addIcon('none', pht('Ignored'));
$ignored_items[] = $item;
}
}
foreach ($ignored_items as $item) {
$list->addItem($item);
}

View file

@ -14,7 +14,8 @@ final class PhabricatorConfigIssueViewController
$user = $request->getUser();
$issues = PhabricatorSetupCheck::runAllChecks();
PhabricatorSetupCheck::setOpenSetupIssueCount(count($issues));
PhabricatorSetupCheck::setOpenSetupIssueCount(
PhabricatorSetupCheck::countUnignoredIssues($issues));
if (empty($issues[$this->issueKey])) {
$content = id(new AphrontErrorView())

View file

@ -9,6 +9,7 @@ final class PhabricatorSetupIssue {
private $summary;
private $shortName;
private $isIgnored = false;
private $phpExtensions = array();
private $phabricatorConfig = array();
private $phpConfig = array();
@ -110,4 +111,12 @@ final class PhabricatorSetupIssue {
return $this->message;
}
public function setIsIgnored($is_ignored) {
$this->isIgnored = $is_ignored;
return $this;
}
public function getIsIgnored() {
return $this->isIgnored;
}
}

View file

@ -122,6 +122,9 @@ final class PhabricatorCoreConfigOptions
$this->newOption('config.mask', 'set', array())
->setLocked(true)
->setDescription(pht('Additional configuration options to mask.')),
$this->newOption('config.ignore-issues', 'set', array())
->setLocked(true)
->setDescription(pht('Setup issues to ignore.')),
$this->newOption('phabricator.env', 'string', null)
->setLocked(true)
->setDescription(pht('Internal.')),