1919use OCP \Cache \CappedMemoryCache ;
2020use OCP \EventDispatcher \IEventDispatcher ;
2121use OCP \Files \Cache \ICacheEntry ;
22+ use OCP \Files \Config \ICachedMountInfo ;
2223use OCP \Files \Config \IUserMountCache ;
2324use OCP \Files \Events \Node \FilesystemTornDownEvent ;
2425use OCP \Files \IRootFolder ;
@@ -405,6 +406,7 @@ public function getFirstNodeByIdInPath(int $id, string $path): ?INode {
405406 */
406407 public function getByIdInPath (int $ id , string $ path ): array {
407408 $ mountCache = $ this ->getUserMountCache ();
409+ $ setupManager = $ this ->mountManager ->getSetupManager ();
408410 if ($ path !== '' && strpos ($ path , '/ ' , 1 ) > 0 ) {
409411 [, $ user ] = explode ('/ ' , $ path );
410412 } else {
@@ -414,7 +416,7 @@ public function getByIdInPath(int $id, string $path): array {
414416
415417 // if the mount isn't in the cache yet, perform a setup first, then try again
416418 if (count ($ mountsContainingFile ) === 0 ) {
417- $ this -> mountManager -> getSetupManager () ->setupForPath ($ path , true );
419+ $ setupManager ->setupForPath ($ path , true );
418420 $ mountsContainingFile = $ mountCache ->getMountsForFileId ($ id , $ user );
419421 }
420422
@@ -436,11 +438,7 @@ public function getByIdInPath(int $id, string $path): array {
436438 }, $ mountsContainingFile ));
437439 $ mountRoots = array_combine ($ mountRootIds , $ mountRootPaths );
438440
439- $ mounts = $ this ->mountManager ->getMountsByMountProvider ($ path , $ mountProviders );
440-
441- $ mountsContainingFile = array_filter ($ mounts , function ($ mount ) use ($ mountRoots ) {
442- return isset ($ mountRoots [$ mount ->getStorageRootId ()]);
443- });
441+ $ mountsContainingFile = array_map ($ this ->mountManager ->getMountFromMountInfo (...), $ mountsContainingFile );
444442
445443 if (count ($ mountsContainingFile ) === 0 ) {
446444 if ($ user === $ this ->getAppDataDirectoryName ()) {
0 commit comments