diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-11-10 17:44:18 +0300 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-11-23 14:27:36 +0300 |
commit | eca5ff31fb10c2469a8c4cebf62f9993d2fed621 (patch) | |
tree | 3b5c0d493f949755713bb52c8d36d2fdf33ad8fb /lib | |
parent | 6c0d4bc2acbfb34e8ca233b4ff1938e4d56dd432 (diff) |
Skip local shares in bkg scan and occ files:scan (#26590)
Local shares should only be scanned when doing it for the owner to
avoid repeatedly rescanning the same shared storage over and over again
for every recipient.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/utils/scanner.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php index cf85ff4c997..e3ef5036bd8 100644 --- a/lib/private/files/utils/scanner.php +++ b/lib/private/files/utils/scanner.php @@ -117,14 +117,20 @@ class Scanner extends PublicEmitter { public function backgroundScan($dir) { $mounts = $this->getMounts($dir); foreach ($mounts as $mount) { - if (is_null($mount->getStorage())) { + $storage = $mount->getStorage(); + if (is_null($storage)) { continue; } // don't scan the root storage - if ($mount->getStorage()->instanceOfStorage('\OC\Files\Storage\Local') && $mount->getMountPoint() === '/') { + if ($storage->instanceOfStorage('\OC\Files\Storage\Local') && $mount->getMountPoint() === '/') { continue; } - $scanner = $mount->getStorage()->getScanner(); + + // don't scan received local shares, these can be scanned when scanning the owner's storage + if ($storage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) { + continue; + } + $scanner = $storage->getScanner(); $this->attachListener($mount); $scanner->backgroundScan(); } @@ -140,10 +146,10 @@ class Scanner extends PublicEmitter { } $mounts = $this->getMounts($dir); foreach ($mounts as $mount) { - if (is_null($mount->getStorage())) { + $storage = $mount->getStorage(); + if (is_null($storage)) { continue; } - $storage = $mount->getStorage(); // if the home storage isn't writable then the scanner is run as the wrong user if ($storage->instanceOfStorage('\OC\Files\Storage\Home') and (!$storage->isCreatable('') or !$storage->isCreatable('files')) @@ -155,6 +161,11 @@ class Scanner extends PublicEmitter { } } + + // don't scan received local shares, these can be scanned when scanning the owner's storage + if ($storage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) { + continue; + } $relativePath = $mount->getInternalPath($dir); $scanner = $storage->getScanner(); $scanner->setUseTransactions(false); |