You are here

protected function SecurityAdvisoriesFetcher::isApplicable in Drupal 9

Determines if a security advisory is applicable for the current site.

Parameters

\Drupal\system\SecurityAdvisories\SecurityAdvisory $sa: The security advisory.

Return value

bool TRUE if the advisory is applicable for the current site, or FALSE otherwise.

1 call to SecurityAdvisoriesFetcher::isApplicable()
SecurityAdvisoriesFetcher::getSecurityAdvisories in core/modules/system/src/SecurityAdvisories/SecurityAdvisoriesFetcher.php
Gets security advisories that are applicable for the current site.

File

core/modules/system/src/SecurityAdvisories/SecurityAdvisoriesFetcher.php, line 286

Class

SecurityAdvisoriesFetcher
Defines a service to get security advisories.

Namespace

Drupal\system\SecurityAdvisories

Code

protected function isApplicable(SecurityAdvisory $sa) : bool {

  // Only projects that are in the site's codebase can be applicable. Core
  // will always be in the codebase, and other projects are in the codebase if
  // ::getProjectInfo() finds a matching extension for the project name.
  if ($sa
    ->isCoreAdvisory() || $this
    ->getMatchingExtensionInfo($sa)) {

    // Public service announcements are always applicable because they are not
    // dependent on the version of the project that is currently present on
    // the site. Other advisories are only applicable if they match the
    // existing version.
    return $sa
      ->isPsa() || $this
      ->matchesExistingVersion($sa);
  }
  return FALSE;
}