function VendorHardeningPlugin::writeAccessRestrictionFiles

Same name in other branches
  1. 8.9.x composer/Plugin/VendorHardening/VendorHardeningPlugin.php \Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin::writeAccessRestrictionFiles()
  2. 10 composer/Plugin/VendorHardening/VendorHardeningPlugin.php \Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin::writeAccessRestrictionFiles()
  3. 11.x composer/Plugin/VendorHardening/VendorHardeningPlugin.php \Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin::writeAccessRestrictionFiles()

Place .htaccess and web.config files into the vendor directory.

Parameters

string $vendor_dir: Path to vendor directory.

1 call to VendorHardeningPlugin::writeAccessRestrictionFiles()
VendorHardeningPlugin::onPostAutoloadDump in composer/Plugin/VendorHardening/VendorHardeningPlugin.php
POST_AUTOLOAD_DUMP event handler.

File

composer/Plugin/VendorHardening/VendorHardeningPlugin.php, line 376

Class

VendorHardeningPlugin
A Composer plugin to clean out your project's vendor directory.

Namespace

Drupal\Composer\Plugin\VendorHardening

Code

public function writeAccessRestrictionFiles($vendor_dir) {
    $this->io
        ->writeError('<info>Hardening vendor directory with .htaccess and web.config files.</info>');
    // Prevent access to vendor directory on Apache servers.
    FileSecurity::writeHtaccess($vendor_dir, TRUE);
    // Prevent access to vendor directory on IIS servers.
    FileSecurity::writeWebConfig($vendor_dir);
}

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