function PhpExtensionsValidator::validateOpenSsl

Flags an error if the OpenSSL extension is not installed.

Parameters

\Drupal\package_manager\Event\PreOperationStageEvent $event: The event object.

File

core/modules/package_manager/src/Validator/PhpExtensionsValidator.php, line 70

Class

PhpExtensionsValidator
Performs validation if certain PHP extensions are enabled.

Namespace

Drupal\package_manager\Validator

Code

public function validateOpenSsl(PreOperationStageEvent $event) : void {
    if (!$this->isExtensionLoaded('openssl')) {
        $message = $this->t('The OpenSSL extension is not enabled, which is a security risk. See <a href=":url">the PHP documentation</a> for information on how to enable this extension.', [
            ':url' => 'https://www.php.net/manual/en/openssl.installation.php',
        ]);
        $event->addError([
            $message,
        ]);
    }
}

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