function PackageManagerRequirements::getRequirements

Overrides InstallRequirementsInterface::getRequirements

File

core/modules/package_manager/src/Install/Requirements/PackageManagerRequirements.php, line 20

Class

PackageManagerRequirements
Install time requirements for the package_manager module.

Namespace

Drupal\package_manager\Install\Requirements

Code

public static function getRequirements() : array {
    $requirements = [];
    if (Settings::get('testing_package_manager', FALSE) === FALSE) {
        $requirements['testing_package_manager'] = [
            'title' => 'Package Manager',
            'description' => t("Package Manager is available for early testing. To install the module set the value of 'testing_package_manager' to TRUE in your settings.php file."),
            'severity' => REQUIREMENT_ERROR,
        ];
    }
    // If we're able to check for the presence of the failure marker at all, do
    // it irrespective of the current run phase. If the failure marker is there,
    // the site is in an indeterminate state and should be restored from backup
    // ASAP.
    $service_id = FailureMarker::class;
    if (\Drupal::hasService($service_id)) {
        try {
            \Drupal::service($service_id)->assertNotExists(NULL);
        } catch (FailureMarkerExistsException $exception) {
            $requirements['package_manager_failure_marker'] = [
                'title' => t('Failed Package Manager update detected'),
                'description' => $exception->getMessage(),
                'severity' => REQUIREMENT_ERROR,
            ];
        }
    }
    return $requirements;
}

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