Web_Site/cloud.home.yimian.xyz/lib/private/Streamer.php
/**
	 * Stream directory recursively
	 * @param string $dir
	 * @param string $internalDir
	 */
Stream directory recursively
@param string $dir
@param string $internalDir
Stream directory recursively @param string $dir @param string $internalDir
public function addDirRecursive($dir, $internalDir='') {
		$dirname = basename($dir);
		$rootDir = $internalDir . $dirname;
		if (!empty($rootDir)) {
			$this->streamerInstance->addEmptyDir($rootDir);
		}
		$internalDir .= $dirname . '/';
		$internalDir = ltrim($internalDir, '/');
		$files= \OC\Files\Filesystem::getDirectoryContent($dir);
		foreach($files as $file) {
			$filename = $file['name'];
			$file = $dir . '/' . $filename;
			if(\OC\Files\Filesystem::is_file($file)) {
				$filesize = \OC\Files\Filesystem::filesize($file);
				$fileTime = \OC\Files\Filesystem::filemtime($file);
				$fh = \OC\Files\Filesystem::fopen($file, 'r');
				$this->addFileFromStream($fh, $internalDir . $filename, $filesize, $fileTime);
				fclose($fh);
			}elseif(\OC\Files\Filesystem::is_dir($file)) {
				$this->addDirRecursive($file, $internalDir);
			}
		}
	}
public function addDirRecursive ( $ dir , $ internalDir = '' ) { $ dirname = basename ( $ dir ) ; $ rootDir = $ internalDir . $ dirname ; if ( ! empty ( $ rootDir ) ) { $ this -> streamerInstance -> addEmptyDir ( $ rootDir ) ; } $ internalDir .= $ dirname . '/' ; $ internalDir = ltrim ( $ internalDir , '/' ) ; $ files = \ OC \ Files \ Filesystem :: getDirectoryContent ( $ dir ) ; foreach ( $ files as $ file ) { $ filename = $ file [ 'name' ] ; $ file = $ dir . '/' . $ filename ; if ( \ OC \ Files \ Filesystem :: is_file ( $ file ) ) { $ filesize = \ OC \ Files \ Filesystem :: filesize ( $ file ) ; $ fileTime = \ OC \ Files \ Filesystem :: filemtime ( $ file ) ; $ fh = \ OC \ Files \ Filesystem :: fopen ( $ file , 'r' ) ; $ this -> addFileFromStream ( $ fh , $ internalDir . $ filename , $ filesize , $ fileTime ) ; fclose ( $ fh ) ; } elseif ( \ OC \ Files \ Filesystem :: is_dir ( $ file ) ) { $ this -> addDirRecursive ( $ file , $ internalDir ) ; } } }
Stream directory recursively
 @param string $dir
 @param string $internalDir
Stream directory recursively @param string $dir @param string $internalDir
// prevent absolute dirs