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 /lib | |
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 'lib')
-rw-r--r-- | lib/private/files/cache/scanner.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index 7c65c721352..f76ef5ba0dd 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -416,11 +416,21 @@ class Scanner extends BasicEmitter { public function backgroundScan() { $lastPath = null; while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) { - $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG); - \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path)); - if ($this->cacheActive) { - $this->cache->correctFolderSize($path); + try { + $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG); + \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path)); + if ($this->cacheActive) { + $this->cache->correctFolderSize($path); + } + } catch (\OCP\Files\StorageInvalidException $e) { + // skip unavailable storages + } catch (\OCP\Files\StorageNotAvailableException $e) { + // skip unavailable storages + } catch (\OCP\Lock\LockedException $e) { + // skip unavailable storages } + // FIXME: this won't proceed with the next item, needs revamping of getIncomplete() + // to make this possible $lastPath = $path; } } |