summaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-23 17:44:02 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-23 17:44:02 +0200
commit524479fa09851f25774bbc71d3ffb1661c01bcbe (patch)
tree153ba2f6cb41a1ea183e78992be91ce71c061ff9 /lib/private/Files
parentc10d8a37f70ecdfeea49b646cd2af96e12895c52 (diff)
parenteca57be3367d9ea462f54cfb227701c8524a6764 (diff)
downloadnextcloud-server-524479fa09851f25774bbc71d3ffb1661c01bcbe.tar.gz
nextcloud-server-524479fa09851f25774bbc71d3ffb1661c01bcbe.zip
Merge pull request #24699 from owncloud/background-scan-recursion
Only recurse into incomplete folders during background scans
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Cache/Scanner.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index fd309a4ac45..06cc6426c59 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -371,7 +371,7 @@ class Scanner extends BasicEmitter implements IScanner {
$childQueue = $this->handleChildren($path, $recursive, $reuse, $folderId, $lock, $size);
foreach ($childQueue as $child => $childId) {
- $childSize = $this->scanChildren($child, self::SCAN_RECURSIVE, $reuse, $childId, $lock);
+ $childSize = $this->scanChildren($child, $recursive, $reuse, $childId, $lock);
if ($childSize === -1) {
$size = -1;
} else if ($size !== -1) {
@@ -402,6 +402,9 @@ class Scanner extends BasicEmitter implements IScanner {
if ($data) {
if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE) {
$childQueue[$child] = $data['fileid'];
+ } else if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE_INCOMPLETE and $data['size'] === -1) {
+ // only recurse into folders which aren't fully scanned
+ $childQueue[$child] = $data['fileid'];
} else if ($data['size'] === -1) {
$size = -1;
} else if ($size !== -1) {
@@ -469,8 +472,8 @@ class Scanner extends BasicEmitter implements IScanner {
} else {
$lastPath = null;
while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
- $this->runBackgroundScanJob(function () use ($path) {
- $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
+ $this->runBackgroundScanJob(function() use ($path) {
+ $this->scan($path, self::SCAN_RECURSIVE_INCOMPLETE, self::REUSE_ETAG | self::REUSE_SIZE);
}, $path);
// FIXME: this won't proceed with the next item, needs revamping of getIncomplete()
// to make this possible