protected function UpdateStatusSensorPlugin::checkContrib in Monitoring 8
Checks contrib status and sets sensor status message.
Parameters
\Drupal\monitoring\Result\SensorResultInterface $result:
array $project_data:
1 call to UpdateStatusSensorPlugin::checkContrib()
- UpdateStatusSensorPlugin::runSensor in src/
Plugin/ monitoring/ SensorPlugin/ UpdateStatusSensorPlugin.php - Runs the sensor, updating $sensor_result.
File
- src/
Plugin/ monitoring/ SensorPlugin/ UpdateStatusSensorPlugin.php, line 87 - Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\UpdateStatusSensorPlugin.
Class
- UpdateStatusSensorPlugin
- Monitors for available updates of Drupal core and installed contrib modules.
Namespace
Drupal\monitoring\Plugin\monitoring\SensorPluginCode
protected function checkContrib(SensorResultInterface $result, $project_data) {
unset($project_data['drupal']);
$updates = [];
$important_updates = [];
foreach ($project_data as $info) {
$status_text = $this
->getStatusText($info['status']);
if (!isset($updates[$status_text])) {
$updates[$status_text] = 0;
}
$updates[$status_text]++;
if ($status_text == 'NOT SECURE' || $status_text == 'not supported') {
if (!isset($important_updates[$status_text])) {
$important_updates[$status_text] = [];
}
$important_updates[$status_text][] = $info;
}
}
foreach ($updates as $status_text => $count) {
$result
->addStatusMessage($count . ' ' . $status_text);
}
foreach ($important_updates as $status_text => $update_info) {
foreach ($update_info as $info) {
if ($status_text == 'NOT SECURE') {
$result
->addStatusMessage('@module (@status, @current => @recommended)', array(
'@module' => $info['info']['name'],
'@status' => $status_text,
'@current' => isset($info['existing_version']) ? $info['existing_version'] : NULL,
'@recommended' => isset($info['recommended']) ? $info['recommended'] : NULL,
));
}
else {
$result
->addStatusMessage('@module (@status, @current)', array(
'@module' => $info['info']['name'],
'@status' => $status_text,
'@current' => isset($info['existing_version']) ? $info['existing_version'] : NULL,
));
}
}
}
}