]> source.dussan.org Git - nextcloud-server.git/commitdiff
make Node::getParent lazy
authorRobin Appelman <robin@icewind.nl>
Tue, 9 May 2023 15:11:20 +0000 (17:11 +0200)
committerRobin Appelman <robin@icewind.nl>
Mon, 4 Sep 2023 16:42:48 +0000 (18:42 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Node/Node.php

index 61ae762638f6a6a1bc04441eea0b3a0f6a232777..0318ae47784c908807d0363779606d5f89350c12 100644 (file)
@@ -300,7 +300,16 @@ class Node implements INode {
                                return $this->root;
                        }
 
-                       $this->parent = $this->root->get($newPath);
+                       $parentData = [
+                               'path' => $newPath,
+                       ];
+                       if ($this->fileInfo instanceof \OC\Files\FileInfo && isset($this->fileInfo['parent'])) {
+                               $parentData['fileid'] = $this->fileInfo['parent'];
+                       }
+
+                       $this->parent = new LazyFolder(function () use ($newPath) {
+                               return $this->root->get($newPath);
+                       }, $parentData);
                }
 
                return $this->parent;