You are here

public function FrxFile::validateCache in Forena Reports 7.4

Validate a single cache entry

Parameters

unknown $ext:

unknown $base_name:

1 call to FrxFile::validateCache()
FrxFile::_validateAllCache in ./FrxFile.inc

File

./FrxFile.inc, line 202
FrxFile.inc File toolbox for manipulating files contained tn the report directory.

Class

FrxFile
@file FrxFile.inc File toolbox for manipulating files contained tn the report directory.

Code

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;
      }
    }
  }
}