public function FileBase::validateCache in Forena Reports 8
Same name and namespace in other branches
- 7.5 src/File/FileBase.php \Drupal\forena\File\FileBase::validateCache()
Validate a single cache entry
Parameters
string $ext:
string $base_name:
1 call to FileBase::validateCache()
- FileBase::_validateAllCache in src/
File/ FileBaseOld.php
File
- src/
File/ FileBaseOld.php, line 197 - FileSystemBase.inc File toolbox for manipulating files contained tn the report directory.
Class
Namespace
Drupal\forena\FileCode
public function validateCache($ext, $base_name) {
if (isset($this->cache[$ext])) {
if (isset($this->cache[$ext][$base_name])) {
$obj = $this->cache[$ext][$base_name];
if (file_exists($obj->file)) {
$mtime = filemtime($obj->file);
if ($obj->cache === NULL || $mtime != $obj->mtime) {
//Expensive cache building process.
$this
->buildCache($ext, $base_name, $obj);
$this->needSave = TRUE;
}
$this->cache[$ext][$base_name] = $obj;
}
else {
// Remove the file from the cache.
unset($this->cache[$ext][$base_name]);
$this->needScan = TRUE;
$this->needSave = TRUE;
}
}
}
}