function ProjectInfo::isInstalledVersionSafe

Checks if the installed version of this project is safe to use.

Return value

bool TRUE if the installed version of this project is secure, supported, and published. Otherwise, or if the project information could not be retrieved, returns FALSE.

File

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

Class

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

Namespace

Drupal\package_manager

Code

public function isInstalledVersionSafe() : bool {
    $project_data = $this->getProjectInfo();
    if ($project_data) {
        $unsafe = [
            UpdateManagerInterface::NOT_SECURE,
            UpdateManagerInterface::NOT_SUPPORTED,
            UpdateManagerInterface::REVOKED,
        ];
        return !in_array($project_data['status'], $unsafe, TRUE);
    }
    // If we couldn't get project data, assume the installed version is unsafe.
    return FALSE;
}

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