Only try to scan the children of directories

This commit is contained in:
Robin Appelman 2014-10-17 17:06:37 +02:00
parent dc6468c2aa
commit 9bbfeada6b
1 changed files with 3 additions and 3 deletions

View File

@ -232,8 +232,8 @@ class Scanner extends BasicEmitter {
$reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG; $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
} }
$data = $this->scanFile($path, $reuse); $data = $this->scanFile($path, $reuse);
if ($data !== null) { if ($data and $data['mimetype'] === 'httpd/unix-directory') {
$size = $this->scanChildren($path, $recursive, $reuse); $size = $this->scanChildren($path, $recursive, $reuse, $data);
$data['size'] = $size; $data['size'] = $size;
} }
return $data; return $data;
@ -262,7 +262,7 @@ class Scanner extends BasicEmitter {
*/ */
protected function getNewChildren($folder) { protected function getNewChildren($folder) {
$children = array(); $children = array();
if ($this->storage->is_dir($folder) && ($dh = $this->storage->opendir($folder))) { if ($dh = $this->storage->opendir($folder)) {
if (is_resource($dh)) { if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) { while (($file = readdir($dh)) !== false) {
if (!Filesystem::isIgnoredDir($file)) { if (!Filesystem::isIgnoredDir($file)) {