You are here

function nagios_updates in Nagios Monitoring 7

Same name and namespace in other branches
  1. 8 nagios.drush.inc \nagios_updates()
  2. 6 nagios.drush.inc \nagios_updates()

Helper function for drush_nagios_updates().

1 call to nagios_updates()
drush_nagios_updates in ./nagios.drush.inc
Drush command callback: nagios-updates.
1 string reference to 'nagios_updates'
nagios_uninstall in ./nagios.install
Implements hook_uninstall().

File

./nagios.drush.inc, line 200
Provides drush integration for the Nagios module.

Code

function nagios_updates($data) {
  if (!is_array($data)) {
    return NULL;
  }
  $updates = [];

  // Create an array of status values keyed by module or theme name, since
  // we'll need this while generating the report if we have to cross reference
  // anything (e.g. subthemes which have base themes missing an update).
  foreach ($data as $project) {
    foreach ($project['includes'] as $key => $name) {
      $status[$key] = $project['status'];
    }
  }
  foreach ($data as $project) {
    if ($project['status'] == UPDATE_NOT_SECURE || $project['status'] == UPDATE_NOT_CURRENT) {
      $row_key = drupal_strtolower($project['name']);
      if (!isset($updates[$row_key])) {
        $updates[$row_key] = [];
      }
      $updates[$row_key]['type'] = $project['project_type'];
      $updates[$row_key]['status'] = $project['status'];
    }
  }
  return $updates;
}