You are here

protected function UpdateStatusSensorPlugin::checkCore in Monitoring 8

Checks core status and sets sensor status message.

Parameters

\Drupal\monitoring\Result\SensorResultInterface $result:

array $project_data:

1 call to UpdateStatusSensorPlugin::checkCore()
UpdateStatusSensorPlugin::runSensor in src/Plugin/monitoring/SensorPlugin/UpdateStatusSensorPlugin.php
Runs the sensor, updating $sensor_result.

File

src/Plugin/monitoring/SensorPlugin/UpdateStatusSensorPlugin.php, line 60
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\SensorPlugin

Code

protected function checkCore(SensorResultInterface $result, $project_data) {
  $info = $project_data['drupal'];
  $status = $this
    ->getStatusText($info['status']);
  if ($status == 'unknown') {
    $result
      ->addStatusMessage('Core update status unknown');

    // Do not escalate in case the status is unknown.
    $result
      ->setStatus(SensorResultInterface::STATUS_INFO);
  }
  elseif ($status == 'current') {
    $result
      ->addStatusMessage('Core up to date');
  }
  else {
    $result
      ->addStatusMessage('Core (@current) - @status - latest @latest', array(
      '@status' => $status,
      '@current' => isset($info['existing_version']) ? $info['existing_version'] : NULL,
      '@latest' => isset($info['latest_version']) ? $info['latest_version'] : NULL,
    ));
  }
}