You are here

protected function FrxFile::scanInclude in Forena Reports 7.4

Parse a drectory

Parameters

unknown $directory:

string $prefix a prefix to use in the base name:

2 calls to FrxFile::scanInclude()
FrxDataFile::scan in ./FrxDataFile.inc
FrxFile::scan in ./FrxFile.inc

File

./FrxFile.inc, line 58
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

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