private function FileBase::scanDirectory in Forena Reports 8
Same name and namespace in other branches
- 7.5 src/File/FileBase.php \Drupal\forena\File\FileBase::scanDirectory()
1 call to FileBase::scanDirectory()
- FileBase::scanInclude in src/
File/ FileBaseOld.php - Parse a drectory
File
- src/
File/ FileBaseOld.php, line 32 - FileSystemBase.inc File toolbox for manipulating files contained tn the report directory.
Class
Namespace
Drupal\forena\FileCode
private function scanDirectory($directory, &$files, $recursive = TRUE) {
// Loop through the directories, ignoring hidden files.
$path = $directory;
// Scan the directory for files.
$d = @dir($path);
if ($d) {
while (false !== ($rpt_file = $d
->read())) {
$src_file = rtrim($d->path, '/') . '/' . trim($rpt_file, '/');
if (is_file($src_file)) {
@(list($base_file, $ext) = explode('.', $rpt_file, 2));
if (array_search($ext, $this->cached_extensions) !== FALSE) {
$files[$ext][$src_file] = filemtime($src_file);
}
}
elseif (is_dir($src_file)) {
if (strpos($rpt_file, '.') !== 0 && $recursive) {
$this
->scanDirectory($src_file, $files, $recursive);
}
}
}
}
if ($d) {
$d
->close();
}
}