function SecurityAdvisoriesFetcher::isApplicable

Same name in other branches
  1. 9 core/modules/system/src/SecurityAdvisories/SecurityAdvisoriesFetcher.php \Drupal\system\SecurityAdvisories\SecurityAdvisoriesFetcher::isApplicable()
  2. 11.x core/modules/system/src/SecurityAdvisories/SecurityAdvisoriesFetcher.php \Drupal\system\SecurityAdvisories\SecurityAdvisoriesFetcher::isApplicable()

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 287

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.