protected function FileBase::scanInclude in Forena Reports 7.5
Same name and namespace in other branches
- 8 src/File/FileBaseOld.php \Drupal\forena\File\FileBase::scanInclude()
Parse a drectory
Parameters
unknown $directory:
string $prefix a prefix to use in the base name:
2 calls to FileBase::scanInclude()
- DataFile::scan in src/
File/ DataFile.php - FileBase::scan in src/
File/ FileBase.php
File
- src/
File/ FileBase.php, line 60 - FileBase.inc File toolbox for manipulating files contained tn the report directory.
Class
Namespace
Drupal\forena\FileCode
protected function scanInclude($directory, $prefix = '') {
$default = strpos($directory, $this->dir) === 0;
$files = array();
$this
->scanDirectory($directory, $files);
foreach ($files as $ext => $files_of_type) {
foreach ($files_of_type as $file => $mtime) {
$base_name = $prefix . substr($file, strlen($directory) + 1, -1 * (strlen($ext) + 1));
if (!isset($this->cache[$ext][$base_name])) {
$obj = new \stdClass();
$obj->file = $file;
$obj->mtime = $mtime;
$obj->cache = NULL;
$obj->include = !$default;
$obj->override = FALSE;
$this->cache[$ext][$base_name] = $obj;
}
else {
// If its our first pas on this replace the entry
$entry = $this->cache[$ext][$base_name];
if (isset($this->filesToDelete[$ext][$base_name])) {
if ($entry->file != $file) {
$entry->file = $file;
$entry->cache = NULL;
$entry->mtime = $mtime;
$entry->include = !$default;
$entry->override = FALSE;
}
}
else {
if (!$entry->override) {
if ($entry->file != $file && strpos($entry->file, $this->dir) === 0) {
$entry->override = TRUE;
}
}
}
unset($this->filesToDelete[$ext][$base_name]);
}
}
}
}