function ProjectInfo::isInstallable

Determines if a release can be installed.

Parameters

\Drupal\update\ProjectRelease $release: The project release.

string[] $support_branches: The supported branches.

Return value

bool TRUE if the release is installable, otherwise FALSE. A release will be considered installable if it is secure, published, supported, and in a supported branch.

File

core/modules/package_manager/src/ProjectInfo.php, line 40

Class

ProjectInfo
Defines a class for retrieving project information from Update module.

Namespace

Drupal\package_manager

Code

private function isInstallable(ProjectRelease $release, array $support_branches) : bool {
    if ($release->isInsecure() || !$release->isPublished() || $release->isUnsupported()) {
        return FALSE;
    }
    $version = ExtensionVersion::createFromVersionString($release->getVersion());
    if ($version->getVersionExtra() === 'dev') {
        return FALSE;
    }
    foreach ($support_branches as $support_branch) {
        $support_branch_version = ExtensionVersion::createFromSupportBranch($support_branch);
        if ($support_branch_version->getMajorVersion() === $version->getMajorVersion() && $support_branch_version->getMinorVersion() === $version->getMinorVersion()) {
            return TRUE;
        }
    }
    return FALSE;
}

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