function VendorHardeningExcluder::excludeVendorHardeningFiles

Same name and namespace in other branches
  1. 11.x core/modules/package_manager/src/PathExcluder/VendorHardeningExcluder.php \Drupal\package_manager\PathExcluder\VendorHardeningExcluder::excludeVendorHardeningFiles()

Excludes vendor hardening files from stage operations.

Parameters

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

File

core/modules/package_manager/src/PathExcluder/VendorHardeningExcluder.php, line 38

Class

VendorHardeningExcluder
Excludes vendor hardening files from stage operations.

Namespace

Drupal\package_manager\PathExcluder

Code

public function excludeVendorHardeningFiles(CollectPathsToExcludeEvent $event) : void {
  // If the core-vendor-hardening plugin (used in the legacy-project template)
  // is present, it may have written security hardening files in the vendor
  // directory. They should always be excluded.
  $vendor_dir = $this->pathLocator
    ->getVendorDirectory();
  $event->addPathsRelativeToProjectRoot([
    $vendor_dir . '/.htaccess',
  ]);
}

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