function SiteFilesExcluder::excludeSiteFiles
Excludes public and private files from stage operations.
Parameters
\Drupal\package_manager\Event\CollectPathsToExcludeEvent $event: The event object.
File
-
core/
modules/ package_manager/ src/ PathExcluder/ SiteFilesExcluder.php, line 44
Class
- SiteFilesExcluder
- Excludes site files from stage operations.
Namespace
Drupal\package_manager\PathExcluderCode
public function excludeSiteFiles(CollectPathsToExcludeEvent $event) : void {
// Exclude files handled by the stream wrappers listed in $this->wrappers.
// These paths could be either absolute or relative, depending on site
// settings. If they are absolute, treat them as relative to the project
// root. Otherwise, treat them as relative to the web root.
foreach ($this->wrappers as $scheme) {
$wrapper = $this->streamWrapperManager
->getViaScheme($scheme);
if ($wrapper instanceof LocalStream) {
$path = $wrapper->getDirectoryPath();
if ($this->fileSystem
->isAbsolutePath($path)) {
if ($path = realpath($path)) {
$event->addPathsRelativeToProjectRoot([
$path,
]);
}
}
else {
$event->addPathsRelativeToWebRoot([
$path,
]);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.