summaryrefslogtreecommitdiffstats
path: root/apps/files/ajax
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-24 16:42:53 +0200
committerVincent Petry <pvince81@owncloud.com>2015-08-24 16:42:53 +0200
commitfe575feca85ee6e6bb7b8b423a60d377bd364193 (patch)
treeb2a93228e59c6c9eac12e9bc2857c1ad5cc43d05 /apps/files/ajax
parenta67a2272e77485391695af84644e7a9074e50af8 (diff)
downloadnextcloud-server-fe575feca85ee6e6bb7b8b423a60d377bd364193.tar.gz
nextcloud-server-fe575feca85ee6e6bb7b8b423a60d377bd364193.zip
Prevent scanner going crazy with unavailable storages
Diffstat (limited to 'apps/files/ajax')
-rw-r--r--apps/files/ajax/scan.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/files/ajax/scan.php b/apps/files/ajax/scan.php
index 3f430cd27ed..7d47a538fa1 100644
--- a/apps/files/ajax/scan.php
+++ b/apps/files/ajax/scan.php
@@ -49,10 +49,14 @@ foreach ($users as $user) {
$scanner = new \OC\Files\Utils\Scanner($user, \OC::$server->getDatabaseConnection());
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', array($listener, 'file'));
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', array($listener, 'folder'));
- if ($force) {
- $scanner->scan($dir);
- } else {
- $scanner->backgroundScan($dir);
+ try {
+ if ($force) {
+ $scanner->scan($dir);
+ } else {
+ $scanner->backgroundScan($dir);
+ }
+ } catch (\Exception $e) {
+ $eventSource->send('error', get_class($e) . ': ' . $e->getMessage());
}
}