public static function Composer::ensureHtaccess in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Composer/Composer.php \Drupal\Core\Composer\Composer::ensureHtaccess()
Ensures that .htaccess and web.config files are present in Composer root.
Parameters
\Composer\Script\Event $event:
File
- core/
lib/ Drupal/ Core/ Composer/ Composer.php, line 163
Class
- Composer
- Provides static functions for composer script events.
Namespace
Drupal\Core\ComposerCode
public static function ensureHtaccess(Event $event) {
// The current working directory for composer scripts is where you run
// composer from.
$vendor_dir = $event
->getComposer()
->getConfig()
->get('vendor-dir');
// Prevent access to vendor directory on Apache servers.
FileSecurity::writeHtaccess($vendor_dir);
// Prevent access to vendor directory on IIS servers.
FileSecurity::writeWebConfig($vendor_dir);
}