diff --git a/apps/files_sharing/lib/ShareRecipientUpdater.php b/apps/files_sharing/lib/ShareRecipientUpdater.php index 979dc41dfb4..cd4f3890721 100644 --- a/apps/files_sharing/lib/ShareRecipientUpdater.php +++ b/apps/files_sharing/lib/ShareRecipientUpdater.php @@ -8,7 +8,6 @@ declare(strict_types=1); namespace OCA\Files_Sharing; -use OC\Files\FileInfo; use OCP\Files\Config\ICachedMountInfo; use OCP\Files\Config\IUserMountCache; use OCP\Files\Storage\IStorageFactory; @@ -77,10 +76,6 @@ class ShareRecipientUpdater { $target = $this->shareTargetValidator->verifyMountPoint($user, $share, $mountsByPath, [$share]); $mountPoint = '/' . $user->getUID() . '/files/' . trim($target, '/') . '/'; - $fileInfo = $share->getNode(); - if (!$fileInfo instanceof FileInfo) { - throw new \Exception('share node is the wrong fileinfo'); - } - $this->userMountCache->addMount($user, $mountPoint, $fileInfo->getData(), MountProvider::class); + $this->userMountCache->addMount($user, $mountPoint, $share->getNode()->getData(), MountProvider::class); } } diff --git a/apps/files_trashbin/lib/Trash/TrashItem.php b/apps/files_trashbin/lib/Trash/TrashItem.php index 70d5164747f..2864a8cd942 100644 --- a/apps/files_trashbin/lib/Trash/TrashItem.php +++ b/apps/files_trashbin/lib/Trash/TrashItem.php @@ -6,6 +6,7 @@ */ namespace OCA\Files_Trashbin\Trash; +use OCP\Files\Cache\ICacheEntry; use OCP\Files\FileInfo; use OCP\IUser; @@ -169,4 +170,8 @@ class TrashItem implements ITrashItem { public function getMetadata(): array { return $this->fileInfo->getMetadata(); } + + public function getData(): ICacheEntry { + return $this->fileInfo->getData(); + } } diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php index c23a7d03ada..58f58c98660 100644 --- a/lib/private/Files/Node/LazyFolder.php +++ b/lib/private/Files/Node/LazyFolder.php @@ -10,6 +10,7 @@ namespace OC\Files\Node; use OC\Files\Filesystem; use OC\Files\Utils\PathHelper; use OCP\Constants; +use OCP\Files\Cache\ICacheEntry; use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountPoint; @@ -565,6 +566,10 @@ class LazyFolder implements Folder { return $this->data['metadata'] ?? $this->__call(__FUNCTION__, func_get_args()); } + public function getData(): ICacheEntry { + return $this->__call(__FUNCTION__, func_get_args()); + } + public function verifyPath($fileName, $readonly = false): void { $this->__call(__FUNCTION__, func_get_args()); } diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index fd8d84883d9..7a7867e6a4e 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -12,6 +12,7 @@ use OC\Files\Mount\MoveableMount; use OC\Files\Utils\PathHelper; use OCP\EventDispatcher\GenericEvent; use OCP\EventDispatcher\IEventDispatcher; +use OCP\Files\Cache\ICacheEntry; use OCP\Files\FileInfo; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; @@ -486,4 +487,8 @@ class Node implements INode { public function getMetadata(): array { return $this->fileInfo->getMetadata(); } + + public function getData(): ICacheEntry { + return $this->fileInfo->getData(); + } } diff --git a/lib/public/Files/FileInfo.php b/lib/public/Files/FileInfo.php index 95419d6354a..117408f23bc 100644 --- a/lib/public/Files/FileInfo.php +++ b/lib/public/Files/FileInfo.php @@ -8,6 +8,7 @@ namespace OCP\Files; use OCP\AppFramework\Attribute\Consumable; +use OCP\Files\Cache\ICacheEntry; use OCP\Files\Storage\IStorage; /** @@ -298,4 +299,12 @@ interface FileInfo { * @since 28.0.0 */ public function getMetadata(): array; + + /** + * Get the filecache data for the file + * + * @return ICacheEntry + * @since 34.0.0 + */ + public function getData(): ICacheEntry; }