2929use OCP \Files \Storage \ISharedStorage ;
3030use OCP \Files \Storage \IStorage ;
3131use OCP \Lock \ILockingProvider ;
32+ use OCP \Server ;
3233use OCP \Share \IShare ;
3334use Psr \Log \LoggerInterface ;
3435
@@ -82,7 +83,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
8283
8384 public function __construct ($ arguments ) {
8485 $ this ->ownerView = $ arguments ['ownerView ' ];
85- $ this ->logger = \ OC :: $ server -> get (LoggerInterface::class);
86+ $ this ->logger = Server:: get (LoggerInterface::class);
8687
8788 $ this ->superShare = $ arguments ['superShare ' ];
8889 $ this ->groupedShares = $ arguments ['groupedShares ' ];
@@ -142,7 +143,7 @@ private function init() {
142143 }
143144
144145 /** @var IRootFolder $rootFolder */
145- $ rootFolder = \ OC :: $ server -> get (IRootFolder::class);
146+ $ rootFolder = Server:: get (IRootFolder::class);
146147 $ this ->ownerUserFolder = $ rootFolder ->getUserFolder ($ this ->superShare ->getShareOwner ());
147148 $ sourceId = $ this ->superShare ->getNodeId ();
148149 $ ownerNodes = $ this ->ownerUserFolder ->getById ($ sourceId );
@@ -431,7 +432,7 @@ public function getCache($path = '', $storage = null) {
431432 $ this ->cache = new \OCA \Files_Sharing \Cache (
432433 $ storage ,
433434 $ sourceRoot ,
434- \ OC :: $ server -> get (CacheDependencies::class),
435+ Server:: get (CacheDependencies::class),
435436 $ this ->getShare ()
436437 );
437438 return $ this ->cache ;
@@ -456,16 +457,15 @@ public function getWatcher($path = '', $storage = null): Watcher {
456457 // Get node information
457458 $ node = $ this ->getShare ()->getNodeCacheEntry ();
458459 if ($ node instanceof CacheEntry) {
459- $ storageId = $ node ->getData ()['storage_string_id ' ];
460+ $ storageId = $ node ->getData ()['storage_string_id ' ] ?? null ;
460461 // for shares from the home storage we can rely on the home storage to keep itself up to date
461462 // for other storages we need use the proper watcher
462- if (!(str_starts_with ($ storageId , 'home:: ' ) || str_starts_with ($ storageId , 'object::user ' ))) {
463+ if ($ storageId !== null && !(str_starts_with ($ storageId , 'home:: ' ) || str_starts_with ($ storageId , 'object::user ' ))) {
463464 $ cache = $ this ->getCache ();
464465 $ this ->watcher = parent ::getWatcher ($ path , $ storage );
465466 if ($ cache instanceof Cache && $ this ->watcher instanceof Watcher) {
466467 $ this ->watcher ->onUpdate ([$ cache , 'markRootChanged ' ]);
467468 }
468-
469469 return $ this ->watcher ;
470470 }
471471 }
0 commit comments