Skip to content
Snippets Groups Projects
Commit 6ced02cd authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3395782 by phenaproxima, rocketeerbkw: Dependence on GLOB_BRACE flag...

Issue #3395782 by phenaproxima, rocketeerbkw: Dependence on GLOB_BRACE flag which is not universally available
parent f3d7be15
No related branches found
No related tags found
2 merge requests!989Issue #3356804 by phenaproxima: Flag a warning during status check if the...,!975UnknownPathExcluder should use readdir() instead of glob() for broader compatibility
......@@ -79,8 +79,25 @@ final class UnknownPathExcluder implements EventSubscriberInterface {
$vendor_dir = $this->pathLocator->getVendorDirectory();
$scaffold_files_paths = $this->getScaffoldFiles();
// Search for all files (including hidden ones) in project root.
$paths_in_project_root = glob("$project_root/{,.}*", GLOB_BRACE);
// Search for all files (including hidden ones) in the project root. We need
// to use readdir() and friends here, rather than glob(), since certain
// glob() flags aren't supported on all systems. We also can't use
// \Drupal\Core\File\FileSystemInterface::scanDirectory(), because it
// unconditionally ignores hidden files and directories.
$paths_in_project_root = [];
$handle = opendir($project_root);
if (empty($handle)) {
throw new \RuntimeException("Could not scan for files in the project root.");
}
while (($entry = readdir($handle)) !== FALSE) {
if ($entry === '.' || $entry === '..') {
continue;
}
$paths_in_project_root[] = $project_root . DIRECTORY_SEPARATOR . $entry;
}
closedir($handle);
$paths = [];
$known_paths = array_merge([$vendor_dir, $web_root, "$project_root/composer.json", "$project_root/composer.lock"], $scaffold_files_paths);
foreach ($paths_in_project_root as $path_in_project_root) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment