aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-06-28 16:09:25 +0200
committerRobin Appelman <robin@icewind.nl>2018-06-28 16:09:25 +0200
commitb9e685236f7933e6b83bcbe6738ca764a6bfd820 (patch)
treebfdd0bb25c1bd8ba2ec4c0c7c866e5938a725355 /lib
parent388ea2234f96be1fc774d4dc02b71e7d67d31910 (diff)
downloadnextcloud-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')
-rw-r--r--lib/private/Files/Utils/Scanner.php11
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;