You are here

private function FrxFile::scanDirectory in Forena Reports 7.4

1 call to FrxFile::scanDirectory()
FrxFile::scanInclude in ./FrxFile.inc
Parse a drectory

File

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

private function scanDirectory($directory, &$files, $recursive = TRUE) {

  // Loop through the directories, ignoring hidden files.
  $path = $directory;

  // Scan the directory for files.
  $d = @dir($path);
  if ($d) {
    while (false !== ($rpt_file = $d
      ->read())) {
      $src_file = rtrim($d->path, '/') . '/' . trim($rpt_file, '/');
      if (is_file($src_file)) {
        @(list($base_file, $ext) = explode('.', $rpt_file, 2));
        if (array_search($ext, $this->cached_extensions) !== FALSE) {
          $files[$ext][$src_file] = filemtime($src_file);
        }
      }
      elseif (is_dir($src_file)) {
        if (strpos($rpt_file, '.') !== 0 && $recursive) {
          $this
            ->scanDirectory($src_file, $files, $recursive);
        }
      }
    }
  }
  if ($d) {
    $d
      ->close();
  }
}