diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-08-25 09:23:42 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-08-25 09:23:42 +0200 |
commit | 2f86be9ced33574a76e821efa45f1ab3939b61e6 (patch) | |
tree | c242a9573653fc01613723c69cae1986d0ace187 /apps | |
parent | 424759908d044866c8d686e9f321df1d1e609fa9 (diff) | |
parent | fe575feca85ee6e6bb7b8b423a60d377bd364193 (diff) | |
download | nextcloud-server-2f86be9ced33574a76e821efa45f1ab3939b61e6.tar.gz nextcloud-server-2f86be9ced33574a76e821efa45f1ab3939b61e6.zip |
Merge pull request #18523 from owncloud/crazy-scanner
Prevent bkg scanner going crazy with unavailable storages (ajax/scan.php)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/scan.php | 12 | ||||
-rw-r--r-- | apps/files/js/files.js | 3 |
2 files changed, 11 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()); } } diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 245648a79e2..4fdc9eb2110 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -333,6 +333,9 @@ function scanFiles(force, dir, users) { scannerEventSource.listen('folder',function(path) { console.log('now scanning ' + path); }); + scannerEventSource.listen('error',function(message) { + console.error('Scanner error: ', message); + }); scannerEventSource.listen('done',function(count) { scanFiles.scanning=false; console.log('done after ' + count + ' files'); |