Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Config/UserMountCache.php')
-rw-r--r--lib/private/Files/Config/UserMountCache.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index 5829fdf512c..f33176b1e7b 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -26,6 +26,7 @@ namespace OC\Files\Config;
use OCA\Files_Sharing\SharedMount;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\Files\Config\ICachedMountFileInfo;
use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Mount\IMountPoint;
@@ -285,7 +286,7 @@ class UserMountCache implements IUserMountCache {
/**
* @param int $fileId
* @param string|null $user optionally restrict the results to a single user
- * @return ICachedMountInfo[]
+ * @return ICachedMountFileInfo[]
* @since 9.0.0
*/
public function getMountsForFileId($fileId, $user = null) {
@@ -297,7 +298,7 @@ class UserMountCache implements IUserMountCache {
$mountsForStorage = $this->getMountsForStorageId($storageId, $user);
// filter mounts that are from the same storage but a different directory
- return array_filter($mountsForStorage, function (ICachedMountInfo $mount) use ($internalPath, $fileId) {
+ $filteredMounts = array_filter($mountsForStorage, function (ICachedMountInfo $mount) use ($internalPath, $fileId) {
if ($fileId === $mount->getRootId()) {
return true;
}
@@ -305,6 +306,18 @@ class UserMountCache implements IUserMountCache {
return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/';
});
+
+ return array_map(function (ICachedMountInfo $mount) use ($internalPath) {
+ return new CachedMountFileInfo(
+ $mount->getUser(),
+ $mount->getStorageId(),
+ $mount->getRootId(),
+ $mount->getMountPoint(),
+ $mount->getMountId(),
+ $mount->getRootInternalPath(),
+ $internalPath
+ );
+ }, $filteredMounts);
}
/**