diff --git a/conf/default.conf.php b/conf/default.conf.php index 4da799d1a4..a45254eaa6 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -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 diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php index e8de542715..90e599e883 100644 --- a/src/applications/config/check/PhabricatorSetupCheck.php +++ b/src/applications/config/check/PhabricatorSetupCheck.php @@ -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; } diff --git a/src/applications/config/controller/PhabricatorConfigIssueListController.php b/src/applications/config/controller/PhabricatorConfigIssueListController.php index f08d08d173..284c4b0cbd 100644 --- a/src/applications/config/controller/PhabricatorConfigIssueListController.php +++ b/src/applications/config/controller/PhabricatorConfigIssueListController.php @@ -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,15 +49,25 @@ 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().'/'); - $item = id(new PhabricatorObjectItemView()) - ->setHeader($issue->getName()) - ->setHref($href) - ->setBarColor('yellow') - ->addIcon('warning', pht('Setup Warning')) - ->addAttribute($issue->getSummary()); + $href = $this->getApplicationURI('/issue/'.$issue->getIssueKey().'/'); + $item = id(new PhabricatorObjectItemView()) + ->setHeader($issue->getName()) + ->setHref($href) + ->setBarColor('yellow') + ->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); } diff --git a/src/applications/config/controller/PhabricatorConfigIssueViewController.php b/src/applications/config/controller/PhabricatorConfigIssueViewController.php index fe59b00d35..bfc294d7ca 100644 --- a/src/applications/config/controller/PhabricatorConfigIssueViewController.php +++ b/src/applications/config/controller/PhabricatorConfigIssueViewController.php @@ -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()) diff --git a/src/applications/config/issue/PhabricatorSetupIssue.php b/src/applications/config/issue/PhabricatorSetupIssue.php index fec0cd0be6..c9a1238a4f 100644 --- a/src/applications/config/issue/PhabricatorSetupIssue.php +++ b/src/applications/config/issue/PhabricatorSetupIssue.php @@ -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; + } } diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php index f6ccba4c69..252f0a30e7 100644 --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -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.')),