diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-11-27 14:02:50 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-11-27 14:02:50 +0100 |
commit | ae71f80f4a3262e3f12de4c71af1cc388904425d (patch) | |
tree | cded4fc50d739239a71da2c1e6b5cd1454103508 /lib | |
parent | 8fe878afe9af165b98470a75203df2f1b32cb68f (diff) | |
download | nextcloud-server-ae71f80f4a3262e3f12de4c71af1cc388904425d.tar.gz nextcloud-server-ae71f80f4a3262e3f12de4c71af1cc388904425d.zip |
Skip unavailable storages in scanner
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/utils/scanner.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php index 460c8007bf4..9b3bae0b9aa 100644 --- a/lib/private/files/utils/scanner.php +++ b/lib/private/files/utils/scanner.php @@ -32,6 +32,8 @@ use OC\Files\Filesystem; use OC\ForbiddenException; use OC\Hooks\PublicEmitter; use OC\Lock\DBLockingProvider; +use OCP\Files\StorageNotAvailableException; +use OCP\ILogger; /** * Class Scanner @@ -59,10 +61,17 @@ class Scanner extends PublicEmitter { protected $db; /** + * @var ILogger + */ + protected $logger; + + /** * @param string $user * @param \OCP\IDBConnection $db + * @param ILogger $logger */ - public function __construct($user, $db) { + public function __construct($user, $db, ILogger $logger) { + $this->logger = $logger; $this->user = $user; $this->propagator = new ChangePropagator(new View('')); $this->db = $db; @@ -161,7 +170,12 @@ class Scanner extends PublicEmitter { if (!$isDbLocking) { $this->db->beginTransaction(); } - $scanner->scan($relativePath, \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); + try { + $scanner->scan($relativePath, \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); + } catch (StorageNotAvailableException $e) { + $this->logger->error('Storage ' . $storage->getId() . ' not available'); + $this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]); + } if (!$isDbLocking) { $this->db->commit(); } |