aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-02-09 09:54:52 +0100
committerRobin Appelman <robin@icewind.nl>2024-03-04 13:57:31 +0100
commite7a7b4a40184dc3da2c83e858c820625f660e48e (patch)
tree367bda0ac814376e7c771fbe4b1c40cf7f33df53 /apps/files_trashbin/lib
parent4d110c1dd6ae384c00c93b4e266118004b71e498 (diff)
downloadnextcloud-server-e7a7b4a40184dc3da2c83e858c820625f660e48e.tar.gz
nextcloud-server-e7a7b4a40184dc3da2c83e858c820625f660e48e.zip
perf: switch places that always use the first getById result to getFirstNodeById
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/Trash/LegacyTrashBackend.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
index 3e749169ad2..ada42dbe857 100644
--- a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
+++ b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
@@ -28,6 +28,7 @@ use OCA\Files_Trashbin\Helper;
use OCA\Files_Trashbin\Storage;
use OCA\Files_Trashbin\Trashbin;
use OCP\Files\FileInfo;
+use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage;
@@ -121,11 +122,11 @@ class LegacyTrashBackend implements ITrashBackend {
try {
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
$trash = $userFolder->getParent()->get('files_trashbin/files');
- $trashFiles = $trash->getById($fileId);
- if (!$trashFiles) {
+ if ($trash instanceof Folder) {
+ return $trash->getFirstNodeById($fileId);
+ } else {
return null;
}
- return $trashFiles ? array_pop($trashFiles) : null;
} catch (NotFoundException $e) {
return null;
}