diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-11-10 15:44:18 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-01-10 16:11:45 +0100 |
commit | 706655ef2000f00c66aa1c4387ab9fa7f60cc537 (patch) | |
tree | 2be8227b3523d1b4db09ccfbb47ffd0792980b03 /tests | |
parent | b727edf17e18e9e0aa9060e6a936078a8d5a8d13 (diff) | |
download | nextcloud-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 'tests')
-rw-r--r-- | tests/lib/Files/Utils/ScannerTest.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php index 7895331d615..6d6007551ce 100644 --- a/tests/lib/Files/Utils/ScannerTest.php +++ b/tests/lib/Files/Utils/ScannerTest.php @@ -188,4 +188,24 @@ class ScannerTest extends \Test\TestCase { $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(''); + } } |