function PhpTufValidator::validate

Reacts to a stage event by validating PHP-TUF configuration as needed.

Parameters

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

File

core/modules/package_manager/src/Validator/PhpTufValidator.php, line 80

Class

PhpTufValidator
Validates that PHP-TUF is installed and correctly configured.

Namespace

Drupal\package_manager\Validator

Code

public function validate(SandboxValidationEvent $event) : void {
  $messages = $this->validateTuf($this->pathLocator
    ->getProjectRoot());
  if ($messages) {
    $event->addError($messages, $this->t('The active directory is not protected by PHP-TUF, which is required to use Package Manager securely.'));
  }
  $sandbox_manager = $event->sandboxManager;
  if ($sandbox_manager->sandboxDirectoryExists()) {
    $messages = $this->validateTuf($sandbox_manager->getSandboxDirectory());
    if ($messages) {
      $event->addError($messages, $this->t('The stage directory is not protected by PHP-TUF, which is required to use Package Manager securely.'));
    }
  }
}

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