You are here

function _s3fs_recursive_dir_scan in S3 File System 7.3

Same name and namespace in other branches
  1. 7.2 s3fs.module \_s3fs_recursive_dir_scan()
1 call to _s3fs_recursive_dir_scan()
_s3fs_copy_file_system_to_s3 in ./s3fs.module
Copies all the local files from the specified file system into S3.

File

./s3fs.module, line 925
Hook implementations and other primary functionality for S3 File System.

Code

function _s3fs_recursive_dir_scan($dir) {
  $output = array();
  $files = scandir($dir);
  foreach ($files as $file) {
    $path = "{$dir}/{$file}";
    if ($file != '.' && $file != '..') {

      // In case they put their private root folder inside their public one,
      // skip it. When listing the private file system contents, $path will
      // never trigger this.
      if ($path == realpath(variable_get('file_private_path'))) {
        continue;
      }
      if (is_dir($path)) {
        $output = array_merge($output, _s3fs_recursive_dir_scan($path));
      }
      else {
        $output[] = $path;
      }
    }
  }
  return $output;
}