summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-01-11 08:16:12 +0100
committerGitHub <noreply@github.com>2017-01-11 08:16:12 +0100
commitf515c6db4a77b0ad1739fa3d0435e392910d59c9 (patch)
treec5a75e9eb337d2e7b1c6ee695b8efcdaa5432bee /lib/private
parenta90cbb0f094f0f418c0e6e78dcd406d34f7b3bd2 (diff)
parent00b17c3af5544b01d7834aa4c8a95c7b3bbf95ca (diff)
downloadnextcloud-server-f515c6db4a77b0ad1739fa3d0435e392910d59c9.tar.gz
nextcloud-server-f515c6db4a77b0ad1739fa3d0435e392910d59c9.zip
Merge pull request #2745 from nextcloud/oc_26590
[downstream] Skip local shares in bkg scan and occ files:scan (#26590)
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Utils/Scanner.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php
index d26c601be1a..98e2c3c8ca2 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -31,6 +31,7 @@ use OC\Files\Filesystem;
use OC\ForbiddenException;
use OC\Hooks\PublicEmitter;
use OC\Lock\DBLockingProvider;
+use OCA\Files_Sharing\SharedStorage;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\ILogger;
@@ -118,14 +119,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(SharedStorage::class)) {
continue;
}
- $storage = $mount->getStorage();
$scanner = $storage->getScanner();
$this->attachListener($mount);
@@ -156,10 +162,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 +177,11 @@ class Scanner extends PublicEmitter {
}
}
+
+ // don't scan received local shares, these can be scanned when scanning the owner's storage
+ if ($storage->instanceOfStorage(SharedStorage::class)) {
+ continue;
+ }
$relativePath = $mount->getInternalPath($dir);
$scanner = $storage->getScanner();
$scanner->setUseTransactions(false);