aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Utils
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-11-10 15:44:18 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-01-10 16:11:45 +0100
commit706655ef2000f00c66aa1c4387ab9fa7f60cc537 (patch)
tree2be8227b3523d1b4db09ccfbb47ffd0792980b03 /lib/private/Files/Utils
parentb727edf17e18e9e0aa9060e6a936078a8d5a8d13 (diff)
downloadnextcloud-server-706655ef2000f00c66aa1c4387ab9fa7f60cc537.tar.gz
nextcloud-server-706655ef2000f00c66aa1c4387ab9fa7f60cc537.zip
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/private/Files/Utils')
-rw-r--r--lib/private/Files/Utils/Scanner.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php
index d26c601be1a..3794e316dfe 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -118,14 +118,19 @@ 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;
+ }
+
+ // don't scan received local shares, these can be scanned when scanning the owner's storage
+ if ($storage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) {
continue;
}
- $storage = $mount->getStorage();
$scanner = $storage->getScanner();
$this->attachListener($mount);
@@ -156,10 +161,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'))
@@ -171,6 +176,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);