You are here

private function FileSystemBase::scanDirectory in Forena Reports 8

Recursive function which scans the directory and loads the base indexes.

Parameters

$directory: Scans a directory ignoring hidden files.

$files:

1 call to FileSystemBase::scanDirectory()
FileSystemBase::scanInclude in src/File/FileSystemBase.php
Parse a drectory

File

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

Class

FileSystemBase

Namespace

Drupal\forena\File

Code

private function scanDirectory(&$directory, &$files) {

  // Scan the directory for files.
  $d = @dir($directory);
  if ($d) {
    while (false !== ($file = $d
      ->read())) {
      $file_path = rtrim($d->path, '/') . '/' . trim($file, '/');

      // Determine extension
      if (is_file($file_path)) {
        @(list($base_file, $ext) = explode('.', $file, 2));
        $files[$ext][$file_path] = filemtime($file_path);
      }
      elseif (is_dir($file_path)) {
        if (strpos($file, '.') !== 0) {
          $this
            ->scanDirectory($file_path, $files);
        }
      }
    }
  }
  if ($d) {
    $d
      ->close();
  }
}