diff options
author | Robin Appelman <robin@icewind.nl> | 2018-06-28 16:09:25 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2018-06-28 16:09:25 +0200 |
commit | b9e685236f7933e6b83bcbe6738ca764a6bfd820 (patch) | |
tree | bfdd0bb25c1bd8ba2ec4c0c7c866e5938a725355 /lib/private/Files/Utils | |
parent | 388ea2234f96be1fc774d4dc02b71e7d67d31910 (diff) | |
download | nextcloud-server-b9e685236f7933e6b83bcbe6738ca764a6bfd820.tar.gz nextcloud-server-b9e685236f7933e6b83bcbe6738ca764a6bfd820.zip |
Add option to only scan the home storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Utils')
-rw-r--r-- | lib/private/Files/Utils/Scanner.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php index f91696e77bb..fe2bf4ccb58 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -182,15 +182,20 @@ class Scanner extends PublicEmitter { /** * @param string $dir - * @throws \OC\ForbiddenException - * @throws \OCP\Files\NotFoundException + * @param $recursive + * @param callable|null $mountFilter + * @throws ForbiddenException + * @throws NotFoundException */ - public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECURSIVE) { + public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECURSIVE, callable $mountFilter = null) { if (!Filesystem::isValidPath($dir)) { throw new \InvalidArgumentException('Invalid path to scan'); } $mounts = $this->getMounts($dir); foreach ($mounts as $mount) { + if ($mountFilter && !$mountFilter($mount)) { + continue; + } $storage = $mount->getStorage(); if (is_null($storage)) { continue; |