From b9e685236f7933e6b83bcbe6738ca764a6bfd820 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 28 Jun 2018 16:09:25 +0200 Subject: Add option to only scan the home storage Signed-off-by: Robin Appelman --- lib/private/Files/Utils/Scanner.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/private/Files/Utils') 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; -- cgit v1.2.3