diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-06-29 15:23:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 15:23:15 +0200 |
commit | e4c3c481a2b27972dd6088d8bf2a82d724ae6d76 (patch) | |
tree | 240fa0fb4183a4259d0bbc8e1aaef9ced368823c /lib | |
parent | 69e92ea71ac5223b6f9c827ba2fa15cacb191f5f (diff) | |
parent | b9e685236f7933e6b83bcbe6738ca764a6bfd820 (diff) | |
download | nextcloud-server-e4c3c481a2b27972dd6088d8bf2a82d724ae6d76.tar.gz nextcloud-server-e4c3c481a2b27972dd6088d8bf2a82d724ae6d76.zip |
Merge pull request #10038 from nextcloud/files-scan-home-only
Add option to only scan the home storage
Diffstat (limited to 'lib')
-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; |