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,16 +438,15 @@ 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+ $ storageId = $ node ->getData ()['storage_string_id ' ] ?? null ;
441442 // for shares from the home storage we can rely on the home storage to keep itself up to date
442443 // for other storages we need use the proper watcher
443- if (!(str_starts_with ($ storageId , 'home:: ' ) || str_starts_with ($ storageId , 'object::user ' ))) {
444+ if ($ storageId !== null && !(str_starts_with ($ storageId , 'home:: ' ) || str_starts_with ($ storageId , 'object::user ' ))) {
444445 $ cache = $ this ->getCache ();
445446 $ this ->watcher = parent ::getWatcher ($ path , $ storage );
446447 if ($ cache instanceof Cache) {
447448 $ this ->watcher ->onUpdate ($ cache ->markRootChanged (...));
448449 }
449-
450450 return $ this ->watcher ;
451451 }
452452 }
0 commit comments