You are here

function composer_manager_sa_cache in Composer Manager 7

Same name and namespace in other branches
  1. 7.2 composer_manager_sa/composer_manager_sa.module \composer_manager_sa_cache()

Return the cached security advisory report.

Parameters

string $lock_file: The URI to the composer.lock file.

Return value

array|NULL The array of cached vulnerabilities, or FALSE if no data is in the cache.

2 calls to composer_manager_sa_cache()
composer_manager_sa_requirements in composer_manager_sa/composer_manager_sa.install
Implements hook_requirements().
composer_manager_sa_vulnerabilities in composer_manager_sa/composer_manager_sa.module
Find any known vulnerabilities in a composer.lock file.
1 string reference to 'composer_manager_sa_cache'
composer_manager_sa_vulnerabilities in composer_manager_sa/composer_manager_sa.module
Find any known vulnerabilities in a composer.lock file.

File

composer_manager_sa/composer_manager_sa.module, line 101
Check for known security issues in Composer libraries.

Code

function composer_manager_sa_cache($lock_file) {
  $vulnerabilities =& drupal_static(__FUNCTION__);

  // If there are no vulnerabilities this is an empty array, so we have to use
  // is_array() to check to see if we are cached or not.
  if (is_array($vulnerabilities)) {
    return $vulnerabilities;
  }
  $cid = composer_manager_sa_cache_cid($lock_file);
  if ($cached = cache_get($cid)) {
    $vulnerabilities = $cached->data;
  }
  return $vulnerabilities;
}