summaryrefslogtreecommitdiffstats
path: root/lib/private/files/view.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-01-20 19:45:32 +0100
committerVincent Petry <pvince81@owncloud.com>2015-01-26 13:59:49 +0100
commitf6e644b43fe3c33ba298ee34a73536c85cc92b4a (patch)
tree7e8fe8eaa51f56765d6147f37a91fad9a1b325d0 /lib/private/files/view.php
parentdc4ceda2f5d1c8007ffd9b5cacbd794f06b1957d (diff)
downloadnextcloud-server-f6e644b43fe3c33ba298ee34a73536c85cc92b4a.tar.gz
nextcloud-server-f6e644b43fe3c33ba298ee34a73536c85cc92b4a.zip
Catch storage exception in scanner for remote shares
Whenever an exception occurs during scan of a remote share, the share is checked for availability. If the storage is gone, it will be removed automatically. Also, getDirectoryContent() will now skip unavailable storages.
Diffstat (limited to 'lib/private/files/view.php')
-rw-r--r--lib/private/files/view.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 76b7d34e756..fd2ba11d30b 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -1037,7 +1037,22 @@ class View {
if ($subCache->getStatus('') === Cache\Cache::NOT_FOUND) {
$subScanner = $subStorage->getScanner('');
- $subScanner->scanFile('');
+ try {
+ $subScanner->scanFile('');
+ } catch (\OCP\Files\StorageNotAvailableException $e) {
+ continue;
+ } catch (\OCP\Files\StorageInvalidException $e) {
+ continue;
+ } catch (\Exception $e) {
+ // sometimes when the storage is not available it can be any exception
+ \OCP\Util::writeLog(
+ 'core',
+ 'Exception while scanning storage "' . $subStorage->getId() . '": ' .
+ get_class($e) . ': ' . $e->getMessage(),
+ \OC_Log::ERROR
+ );
+ continue;
+ }
}
$rootEntry = $subCache->get('');