diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-05-20 09:29:37 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-05-20 09:29:37 +0200 |
commit | 2ef751b1ec28f7b5c7113af60ec8c9fa0ae1cf87 (patch) | |
tree | dd84c14e8ff82251620ac80f8ab42808e55829ca /apps/files | |
parent | b4958950178901ffd5b1d466f67b64558a8e5298 (diff) | |
parent | f313105dbd45261ca8fa2aefadb2fa400560d27c (diff) | |
download | nextcloud-server-2ef751b1ec28f7b5c7113af60ec8c9fa0ae1cf87.tar.gz nextcloud-server-2ef751b1ec28f7b5c7113af60ec8c9fa0ae1cf87.zip |
Merge pull request #24702 from owncloud/background-scan-occ
add --unscanned option to files:scan to triger a background scan
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/Command/Scan.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 1ae04c585bb..cf4f8f1745d 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -86,6 +86,11 @@ class Scan extends Base { null, InputOption::VALUE_NONE, 'will rescan all files of all known users' + )->addOption( + 'unscanned', + null, + InputOption::VALUE_NONE, + 'only scan files which are marked as not fully scanned' ); } @@ -98,7 +103,7 @@ class Scan extends Base { } } - protected function scanFiles($user, $path, $verbose, OutputInterface $output) { + protected function scanFiles($user, $path, $verbose, OutputInterface $output, $backgroundScan = false) { $scanner = new \OC\Files\Utils\Scanner($user, \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception # printout and count @@ -143,7 +148,11 @@ class Scan extends Base { }); try { - $scanner->scan($path); + if ($backgroundScan) { + $scanner->backgroundScan($path); + }else { + $scanner->scan($path); + } } catch (ForbiddenException $e) { $output->writeln("<error>Home storage for user $user not writable</error>"); $output->writeln("Make sure you're running the scan command only as the user the web server runs as"); @@ -210,7 +219,7 @@ class Scan extends Base { if ($verbose) {$output->writeln(""); } $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); + $this->scanFiles($user, $path, $verbose, $output, $input->getOption('unscanned')); } else { $output->writeln("<error>Unknown user $user_count $user</error>"); } |