Commit 6365c57b authored by Robin Appelman's avatar Robin Appelman
Browse files

Merge pull request #11282 from owncloud/scanner-memory-stable7

Don't keep the full info of all children in memory
parents 9fc23e19 f88021db
...@@ -224,6 +224,17 @@ class Scanner extends BasicEmitter { ...@@ -224,6 +224,17 @@ class Scanner extends BasicEmitter {
return $data; return $data;
} }
protected function getExistingChildren($path) {
$existingChildren = array();
if ($this->cache->inCache($path)) {
$children = $this->cache->getFolderContents($path);
foreach ($children as $child) {
$existingChildren[] = $child['name'];
}
}
return $existingChildren;
}
/** /**
* scan all the files and folders in a folder * scan all the files and folders in a folder
* *
...@@ -239,13 +250,7 @@ class Scanner extends BasicEmitter { ...@@ -239,13 +250,7 @@ class Scanner extends BasicEmitter {
$this->emit('\OC\Files\Cache\Scanner', 'scanFolder', array($path, $this->storageId)); $this->emit('\OC\Files\Cache\Scanner', 'scanFolder', array($path, $this->storageId));
$size = 0; $size = 0;
$childQueue = array(); $childQueue = array();
$existingChildren = array(); $existingChildren = $this->getExistingChildren($path);
if ($this->cache->inCache($path)) {
$children = $this->cache->getFolderContents($path);
foreach ($children as $child) {
$existingChildren[] = $child['name'];
}
}
$newChildren = array(); $newChildren = array();
if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) { if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) {
$exceptionOccurred = false; $exceptionOccurred = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment