3636use OCP \Files \Storage \ISharedStorage ;
3737use OCP \Files \Storage \IStorage ;
3838use OCP \Lock \ILockingProvider ;
39+ use OCP \Server ;
3940use OCP \Share \IShare ;
4041use OCP \Util ;
4142use Psr \Log \LoggerInterface ;
@@ -90,7 +91,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage
9091
9192 public function __construct (array $ parameters ) {
9293 $ this ->ownerView = $ parameters ['ownerView ' ];
93- $ this ->logger = \ OC :: $ server -> get (LoggerInterface::class);
94+ $ this ->logger = Server:: get (LoggerInterface::class);
9495
9596 $ this ->superShare = $ parameters ['superShare ' ];
9697 $ this ->groupedShares = $ parameters ['groupedShares ' ];
@@ -150,7 +151,7 @@ private function init() {
150151 }
151152
152153 /** @var IRootFolder $rootFolder */
153- $ rootFolder = \ OC :: $ server -> get (IRootFolder::class);
154+ $ rootFolder = Server:: get (IRootFolder::class);
154155 $ this ->ownerUserFolder = $ rootFolder ->getUserFolder ($ this ->superShare ->getShareOwner ());
155156 $ sourceId = $ this ->superShare ->getNodeId ();
156157 $ ownerNodes = $ this ->ownerUserFolder ->getById ($ sourceId );
@@ -412,7 +413,7 @@ public function getCache(string $path = '', ?IStorage $storage = null): ICache {
412413 $ this ->cache = new Cache (
413414 $ storage ,
414415 $ sourceRoot ,
415- \ OC :: $ server -> get (CacheDependencies::class),
416+ Server:: get (CacheDependencies::class),
416417 $ this ->getShare ()
417418 );
418419 return $ this ->cache ;
@@ -437,17 +438,20 @@ public function getWatcher(string $path = '', ?IStorage $storage = null): IWatch
437438 // Get node information
438439 $ node = $ this ->getShare ()->getNodeCacheEntry ();
439440 if ($ node instanceof CacheEntry) {
440- $ storageId = $ node ->getData ()['storage_string_id ' ];
441- // for shares from the home storage we can rely on the home storage to keep itself up to date
442- // for other storages we need use the proper watcher
443- if (!(str_starts_with ($ storageId , 'home:: ' ) || str_starts_with ($ storageId , 'object::user ' ))) {
444- $ cache = $ this ->getCache ();
445- $ this ->watcher = parent ::getWatcher ($ path , $ storage );
446- if ($ cache instanceof Cache) {
447- $ this ->watcher ->onUpdate ($ cache ->markRootChanged (...));
441+ $ data = $ node ->getData ();
442+ if (isset ($ data ['storage_string_id ' ])) {
443+ $ storageId = $ data ['storage_string_id ' ];
444+ // for shares from the home storage we can rely on the home storage to keep itself up to date
445+ // for other storages we need use the proper watcher
446+ if (!(str_starts_with ($ storageId , 'home:: ' ) || str_starts_with ($ storageId , 'object::user ' ))) {
447+ $ cache = $ this ->getCache ();
448+ $ this ->watcher = parent ::getWatcher ($ path , $ storage );
449+ if ($ cache instanceof Cache) {
450+ $ this ->watcher ->onUpdate ($ cache ->markRootChanged (...));
451+ }
452+
453+ return $ this ->watcher ;
448454 }
449-
450- return $ this ->watcher ;
451455 }
452456 }
453457
0 commit comments