You are here

function _nagios_update_get_projects in Nagios Monitoring 7

Wrapper function to ensure update_get_projects() can always be accessed, even if the core update module is disabled.

4 calls to _nagios_update_get_projects()
nagios_check_requirements in ./nagios.module
Check all Drupal requirements are satisfied.
nagios_form_system_modules_alter in ./nagios.module
Implements hook_form_FORMID_alter().
nagios_form_system_theme_settings_alter in ./nagios.module
Implements hook_form_FORMID_alter().
nagios_status_page in ./nagios.module
Callback for the nagios status page

File

./nagios.module, line 1302

Code

function _nagios_update_get_projects() {
  if (module_exists('update')) {
    return update_get_projects();
  }

  // We still need to make sure the update.compare file is available to call the
  // _update_process_info_list(() function below.
  module_load_include('inc', 'update', 'update.compare');

  // This code is lifted directly from the core update module to avoid a dependency.
  // Note: anything cache related has been pulled out.
  // https://api.drupal.org/api/drupal/modules!update!update.compare.inc/function/update_get_projects/7.x
  $projects =& drupal_static(__FUNCTION__, []);
  if (empty($projects)) {

    // Still empty, so we have to rebuild the cache.
    $module_data = system_rebuild_module_data();
    $theme_data = system_rebuild_theme_data();
    _update_process_info_list($projects, $module_data, 'module', TRUE);
    _update_process_info_list($projects, $theme_data, 'theme', TRUE);
    if (variable_get('update_check_disabled', FALSE)) {
      _update_process_info_list($projects, $module_data, 'module', FALSE);
      _update_process_info_list($projects, $theme_data, 'theme', FALSE);
    }

    // Allow other modules to alter projects before fetching and comparing.
    drupal_alter('update_projects', $projects);
  }
  return $projects;
}