@@ -156,33 +156,37 @@ protected function attachListener($mount) {
156156 public function backgroundScan ($ dir ) {
157157 $ mounts = $ this ->getMounts ($ dir );
158158 foreach ($ mounts as $ mount ) {
159- $ storage = $ mount ->getStorage ();
160- if (is_null ($ storage )) {
161- continue ;
162- }
159+ try {
160+ $ storage = $ mount ->getStorage ();
161+ if (is_null ($ storage )) {
162+ continue ;
163+ }
163164
164- // don't bother scanning failed storages (shortcut for same result)
165- if ($ storage ->instanceOfStorage (FailedStorage::class)) {
166- continue ;
167- }
165+ // don't bother scanning failed storages (shortcut for same result)
166+ if ($ storage ->instanceOfStorage (FailedStorage::class)) {
167+ continue ;
168+ }
168169
169- $ scanner = $ storage ->getScanner ();
170- $ this ->attachListener ($ mount );
170+ $ scanner = $ storage ->getScanner ();
171+ $ this ->attachListener ($ mount );
171172
172- $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'removeFromCache ' , function ($ path ) use ($ storage ) {
173- $ this ->triggerPropagator ($ storage , $ path );
174- });
175- $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'updateCache ' , function ($ path ) use ($ storage ) {
176- $ this ->triggerPropagator ($ storage , $ path );
177- });
178- $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'addToCache ' , function ($ path ) use ($ storage ) {
179- $ this ->triggerPropagator ($ storage , $ path );
180- });
173+ $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'removeFromCache ' , function ($ path ) use ($ storage ) {
174+ $ this ->triggerPropagator ($ storage , $ path );
175+ });
176+ $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'updateCache ' , function ($ path ) use ($ storage ) {
177+ $ this ->triggerPropagator ($ storage , $ path );
178+ });
179+ $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'addToCache ' , function ($ path ) use ($ storage ) {
180+ $ this ->triggerPropagator ($ storage , $ path );
181+ });
181182
182- $ propagator = $ storage ->getPropagator ();
183- $ propagator ->beginBatch ();
184- $ scanner ->backgroundScan ();
185- $ propagator ->commitBatch ();
183+ $ propagator = $ storage ->getPropagator ();
184+ $ propagator ->beginBatch ();
185+ $ scanner ->backgroundScan ();
186+ $ propagator ->commitBatch ();
187+ } catch (\Exception $ e ) {
188+ $ this ->logger ->error ("Error while trying to scan mount as {$ mount ->getMountPoint ()}: " . $ e ->getMessage (), ['exception ' => $ e , 'app ' => 'files ' ]);
189+ }
186190 }
187191 }
188192
0 commit comments