summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-06-25 13:01:22 +0200
committerGitHub <noreply@github.com>2018-06-25 13:01:22 +0200
commit587d7cc7d217e2204fd677dcc787e61a6ba0a381 (patch)
treed11c16cbe6f98cee7f64fddf7f4c16b50e728379 /apps/files
parenta431cc3b58dc5ab2c4c1b47be2e11a35f850631e (diff)
parent4a3471595aec40aca825339a2446d9f9dd8ab963 (diff)
downloadnextcloud-server-587d7cc7d217e2204fd677dcc787e61a6ba0a381.tar.gz
nextcloud-server-587d7cc7d217e2204fd677dcc787e61a6ba0a381.zip
Merge pull request #9526 from Blaok/files-scan-shallow
allow shallow (non-recursive) scan when scanning file storage
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/lib/Command/Scan.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php
index c3b63f053f5..fed7eb25653 100644
--- a/apps/files/lib/Command/Scan.php
+++ b/apps/files/lib/Command/Scan.php
@@ -97,6 +97,11 @@ class Scan extends Base {
null,
InputOption::VALUE_NONE,
'only scan files which are marked as not fully scanned'
+ )->addOption(
+ 'shallow',
+ null,
+ InputOption::VALUE_NONE,
+ 'do not scan folders recursively'
);
}
@@ -109,7 +114,7 @@ class Scan extends Base {
}
}
- protected function scanFiles($user, $path, $verbose, OutputInterface $output, $backgroundScan = false) {
+ protected function scanFiles($user, $path, $verbose, OutputInterface $output, $backgroundScan = false, $recursive = true) {
$connection = $this->reconnectToDatabase($output);
$scanner = new \OC\Files\Utils\Scanner($user, $connection, \OC::$server->getLogger());
# check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception
@@ -158,7 +163,7 @@ class Scan extends Base {
if ($backgroundScan) {
$scanner->backgroundScan($path);
} else {
- $scanner->scan($path);
+ $scanner->scan($path, $recursive);
}
} catch (ForbiddenException $e) {
$output->writeln("<error>Home storage for user $user not writable</error>");
@@ -231,7 +236,7 @@ class Scan extends Base {
}
$output->writeln("Starting scan for user $user_count out of $users_total ($user)");
# full: printout data if $verbose was set
- $this->scanFiles($user, $path, $verbose, $output, $input->getOption('unscanned'));
+ $this->scanFiles($user, $path, $verbose, $output, $input->getOption('unscanned'), ! $input->getOption('shallow'));
} else {
$output->writeln("<error>Unknown user $user_count $user</error>");
}