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);
}
$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'))
}
}
+
+ // 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);
$this->assertNotEquals($oldRoot->getEtag(), $newRoot->getEtag());
}
+
+ public function testSkipLocalShares() {
+ $sharedStorage = $this->createMock('OCA\Files_Sharing\SharedStorage');
+ $sharedMount = new MountPoint($sharedStorage, '/share');
+ Filesystem::getMountManager()->addMount($sharedMount);
+
+ $sharedStorage->expects($this->any())
+ ->method('instanceOfStorage')
+ ->will($this->returnValueMap([
+ ['OCA\Files_Sharing\ISharedStorage', true],
+ ]));
+ $sharedStorage->expects($this->never())
+ ->method('getScanner');
+
+ $scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), \OC::$server->getLogger());
+ $scanner->addMount($sharedMount);
+ $scanner->scan('');
+
+ $scanner->backgroundScan('');
+ }
}