From ae71f80f4a3262e3f12de4c71af1cc388904425d Mon Sep 17 00:00:00 2001 From: Robin Appelman <icewind@owncloud.com> Date: Fri, 27 Nov 2015 14:02:50 +0100 Subject: Skip unavailable storages in scanner --- apps/files/command/scan.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apps/files/command/scan.php') diff --git a/apps/files/command/scan.php b/apps/files/command/scan.php index 99ce64e09cc..31ae555e041 100644 --- a/apps/files/command/scan.php +++ b/apps/files/command/scan.php @@ -26,6 +26,7 @@ namespace OCA\Files\Command; use OC\ForbiddenException; +use OCP\Files\StorageNotAvailableException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -74,7 +75,7 @@ class Scan extends Command { } protected function scanFiles($user, $path, $quiet, OutputInterface $output) { - $scanner = new \OC\Files\Utils\Scanner($user, \OC::$server->getDatabaseConnection()); + $scanner = new \OC\Files\Utils\Scanner($user, \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); if (!$quiet) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { $output->writeln("Scanning file <info>$path</info>"); @@ -82,6 +83,9 @@ class Scan extends Command { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { $output->writeln("Scanning folder <info>$path</info>"); }); + $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) { + $output->writeln("Error while scanning, storage not available (" . $e->getMessage() . ")"); + }); } try { $scanner->scan($path); -- cgit v1.2.3