protected function UnmanagedFilesService::getSubDirectories in Fancy File Delete 2.0.x
Answer an array of directory paths and URI's.
Parameters
string $dir The file-system path of the directory.:
string $uri_prefix The prefix, e.g. 'public://' or 'private://':
array $exclude_paths File-system paths to exclude from the results.:
Return value
array
1 call to UnmanagedFilesService::getSubDirectories()
- UnmanagedFilesService::getDirs in src/
UnmanagedFilesService.php - Answer a list of directories to include/exclude.
File
- src/
UnmanagedFilesService.php, line 239
Class
- UnmanagedFilesService
- Class UnmanagedFilesService.
Namespace
Drupal\fancy_file_deleteCode
protected function getSubDirectories($dir, $uri_prefix, array $exclude_paths = []) {
$results = [];
$iterator = new \RecursiveIteratorIterator(new FancyFileDeleteDirectoryOnlyRecursiveFilterIterator(new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS), $exclude_paths), \RecursiveIteratorIterator::SELF_FIRST, \RecursiveIteratorIterator::CATCH_GET_CHILD);
// Go through each one and add a proper uri.
foreach ($iterator as $file) {
$results[] = str_replace($dir . '/', $uri_prefix, $file
->getPathname());
}
return $results;
}