You are here

public function FileBase::validateAllCache in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 src/File/FileBaseOld.php \Drupal\forena\File\FileBase::validateAllCache()

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 FileBase::validateAllCache()
DataFile::userBlocks in src/File/DataFile.php
List all the reports for a language.
FileBase::getCacheEntry in src/File/FileBase.php
Returns the cache entry based on a filename.
ReportFile::allReports in src/File/ReportFile.php
List all the reports for a language.
ReportFile::getReportCacheInfo in src/File/ReportFile.php
Get the cached information for a single report.
ReportFile::menuReports in src/File/ReportFile.php

... See full list

File

src/File/FileBase.php, line 157
FileBase.inc File toolbox for manipulating files contained tn the report directory.

Class

FileBase

Namespace

Drupal\forena\File

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