protected function SensorDrupalUpdate::calculateStatus in Monitoring 7
Executes the update requirements hook and calculates the status for it.
Parameters
string $type: Which types of updates to check for, core or contrib.
Return value
string One of the SensorResultInterface status constants.
1 call to SensorDrupalUpdate::calculateStatus()
- SensorDrupalUpdate::runSensor in lib/
Drupal/ monitoring/ Sensor/ Sensors/ SensorDrupalUpdate.php - Runs the sensor, updating $sensor_result.
File
- lib/
Drupal/ monitoring/ Sensor/ Sensors/ SensorDrupalUpdate.php, line 168 - Contains \Drupal\monitoring\Sensor\Sensors\SensorDrupalUpdate.
Class
- SensorDrupalUpdate
- Monitors for available updates of Drupal core and installed contrib modules.
Namespace
Drupal\monitoring\Sensor\SensorsCode
protected function calculateStatus($type) {
module_load_include('install', 'update');
$requirements = update_requirements('runtime');
$update_info = array();
if (isset($requirements['update_' . $type])) {
$update_info = $requirements['update_' . $type];
}
$update_info += array(
'severity' => REQUIREMENT_OK,
);
if ($update_info['severity'] == REQUIREMENT_OK) {
return SensorResultInterface::STATUS_OK;
}
elseif ($update_info['severity'] == REQUIREMENT_INFO) {
return SensorResultInterface::STATUS_INFO;
}
elseif ($update_info['severity'] == REQUIREMENT_WARNING) {
return SensorResultInterface::STATUS_INFO;
}
else {
return SensorResultInterface::STATUS_CRITICAL;
}
}