feat: export getData for public FileInfo interface

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2026-02-17 18:19:30 +01:00 committed by Louis Chmn
parent 7c53aff96f
commit 42c6ffa7a9
5 changed files with 25 additions and 6 deletions

View file

@ -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);
}
}

View file

@ -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();
}
}

View file

@ -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());
}

View file

@ -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();
}
}

View file

@ -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;
}