diff options
author | Robin Appelman <robin@icewind.nl> | 2024-03-05 17:26:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 17:26:25 +0100 |
commit | fd4ca13867de94e3afc5cac55ac39c4235d6b737 (patch) | |
tree | 55687140e7a7ec2f3612092f5be291ed698d0337 /lib/public | |
parent | c18ffe0cad13dc5903cbb08ffbdb787f01db5e35 (diff) | |
parent | a9ee278ec6059d164ed2f45b0eb304e940ffd588 (diff) | |
download | nextcloud-server-fd4ca13867de94e3afc5cac55ac39c4235d6b737.tar.gz nextcloud-server-fd4ca13867de94e3afc5cac55ac39c4235d6b737.zip |
Merge pull request #43471 from nextcloud/cache-path-by-id
Cache path by id
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Files/Folder.php | 22 | ||||
-rw-r--r-- | lib/public/Files/IRootFolder.php | 18 | ||||
-rw-r--r-- | lib/public/Share/IShare.php | 2 |
3 files changed, 40 insertions, 2 deletions
diff --git a/lib/public/Files/Folder.php b/lib/public/Files/Folder.php index eb81a2098ec..945df48a13e 100644 --- a/lib/public/Files/Folder.php +++ b/lib/public/Files/Folder.php @@ -152,11 +152,13 @@ interface Folder extends Node { public function searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0); /** - * get a file or folder inside the folder by it's internal id + * get a file or folder inside the folder by its internal id * * This method could return multiple entries. For example once the file/folder * is shared or mounted (files_external) to the user multiple times. * + * Note that the different entries can have different permissions. + * * @param int $id * @return \OCP\Files\Node[] * @since 6.0.0 @@ -164,6 +166,24 @@ interface Folder extends Node { public function getById($id); /** + * get a file or folder inside the folder by its internal id + * + * Unlike getById, this method only returns a single node even if the user has + * access to the file with the requested id multiple times. + * + * This method provides no guarantee about which of the nodes in returned and the + * returned node might, for example, have less permissions than other nodes for the same file + * + * Apps that require accurate information about the users access to the file should use getById + * instead of pick the correct node out of the result. + * + * @param int $id + * @return Node|null + * @since 29.0.0 + */ + public function getFirstNodeById(int $id): ?Node; + + /** * Get the amount of free space inside the folder * * @return int diff --git a/lib/public/Files/IRootFolder.php b/lib/public/Files/IRootFolder.php index 44f0ba5f2e1..c1c0e6e8c72 100644 --- a/lib/public/Files/IRootFolder.php +++ b/lib/public/Files/IRootFolder.php @@ -60,6 +60,24 @@ interface IRootFolder extends Folder, Emitter { public function getByIdInPath(int $id, string $path); /** + * get a file or folder inside the folder by its internal id + * + * Unlike getByIdInPath, this method only returns a single node even if the user has + * access to the file with the requested id multiple times. + * + * This method provides no guarantee about which of the nodes in returned and the + * returned node might, for example, have less permissions than other nodes for the same file + * + * Apps that require accurate information about the users access to the file should use getByIdInPath + * instead of pick the correct node out of the result. + * + * @param int $id + * @return Node|null + * @since 29.0.0 + */ + public function getFirstNodeByIdInPath(int $id, string $path): ?Node; + + /** * @return IMountPoint[] * * @since 28.0.0 diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php index 74d404101cd..a059696a75e 100644 --- a/lib/public/Share/IShare.php +++ b/lib/public/Share/IShare.php @@ -213,7 +213,7 @@ interface IShare { * @since 9.0.0 * @throws NotFoundException */ - public function getNodeId(); + public function getNodeId(): int; /** * Set the type of node (file/folder) |