You are here

public function FrxFile::validateAllCache in Forena Reports 7.4

Called anytime we want to make sure the include cache is good and complete. Any file modifications will cause cache to be rebuild to be rebuilt.

Parameters

unknown $ext:

string $prefix:

7 calls to FrxFile::validateAllCache()
FrxDataFile::userBlocks in ./FrxDataFile.inc
List all the reports for a language.
FrxFile::getCacheEntry in ./FrxFile.inc
Returns the cache entry based on a filename.
FrxReportFile::allReports in ./FrxReportFile.inc
List all the reports for a language.
FrxReportFile::getReportCacheInfo in ./FrxReportFile.inc
Get the cached information for a single report.
FrxReportFile::menuReports in ./FrxReportFile.inc

... See full list

File

./FrxFile.inc, line 155
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 validateAllCache($prefix = '') {

  // Make sure once per session.
  if (!$this->cache) {
    $cache = cache_get($this->cacheKey, 'cache');
    if ($cache) {
      $this->cache = $cache->data;
    }
    $this->needSave = FALSE;
  }

  // Skip extra stuff after we've validated once.
  if ($this->validated) {
    return;
  }

  // Load data form the cache
  // Save current paths away.
  $this
    ->setFilesToDelete();
  $this
    ->scan($prefix);
  $this
    ->_validateAllCache($prefix);

  //Rescan in case we found deleted files.
  if ($this->needScan) {
    $this
      ->scan($prefix);
    $this
      ->_validateAllCache($prefix);
  }

  //Remove any reports that have dissapeared.
  $this
    ->deleteMissingEntries();

  //Resave the cache if had to be altered.
  if ($this->needSave) {
    cache_set($this->cacheKey, $this->cache, 'cache', CACHE_PERMANENT);
  }

  //$this->needScan = FALSE;
  $this->validated = TRUE;
}