public function RequirementsController::findMostSevereProblem in Nagios Monitoring 8
File
- src/
Controller/ RequirementsController.php, line 82
Class
- RequirementsController
- Get the run-time requirements and status information. module_invoke_all('requirements', 'runtime') returns an array that isn't keyed by the module name, eg we might get a key 'ctools_css_cache'. We have no way of…
Namespace
Drupal\nagios\ControllerCode
public function findMostSevereProblem() : array {
$descriptions = [];
$min_severity = $this->config
->get('nagios.min_report_severity');
foreach ($this->reqs as $key => $requirement) {
if (isset($requirement['severity'])) {
// Ignore update_core warning if update check is pending:
if (($key == 'update_core' || $key == 'update_contrib') && $requirement['severity'] == REQUIREMENT_ERROR && $requirement['reason'] == UpdateFetcherInterface::FETCH_PENDING) {
continue;
}
if ($requirement['severity'] >= $min_severity) {
if ($requirement['severity'] > $this->severity) {
$this->severity = $requirement['severity'];
}
$descriptions[] = $requirement['title'];
}
}
}
if (empty($descriptions)) {
$desc = $this
->t('No information.');
}
else {
$desc = implode(', ', $descriptions);
}
return [
$this->severity,
$desc,
];
}