function ValidateService::dirScan in S3 File System 8.2
Scans a given directory.
Parameters
$dir: The directory to be scanned.
Return value
array Array of file paths.
1 call to ValidateService::dirScan()
- ValidateService::copyFileSystemToS3 in src/
ValidateService.php - Copies all the local files from the specified file system into S3.
File
- src/
ValidateService.php, line 222
Class
- ValidateService
- Defines a ValidateService service.
Namespace
Drupal\s3fsCode
function dirScan($dir) {
$output = [];
$files = scandir($dir);
foreach ($files as $file) {
$path = "{$dir}/{$file}";
if ($file != '.' && $file != '..') {
// In case they put their private root folder inside their public one,
// skip it. When listing the private file system contents, $path will
// never trigger this.
if ($path == realpath(PrivateStream::basePath() ? PrivateStream::basePath() : '')) {
continue;
}
if (is_dir($path)) {
$output = array_merge($output, $this
->dirScan($path));
}
else {
$output[] = $path;
}
}
}
return $output;
}