From 9735b5d61f8577fea01810b5de3e1dab2ec6c77e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 27 Mar 2020 17:47:20 +0100 Subject: Add method to storage backends to get directory content with metadata Currently you need to use `opendir` and then call `getMetadata` for every file, which adds overhead because most storage backends already get the metadata when doing the `opendir`. While storagebackends can (and do) use caching to relief this problem, this adds cache invalidation dificulties and only a limited number of items are generally cached (to prevent memory usage exploding when scanning large storages) With this new methods storage backends can use the child metadata they got from listing the folder to return metadata without having to keep seperate caches. Signed-off-by: Robin Appelman --- lib/private/Files/Storage/Wrapper/Encoding.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/private/Files/Storage/Wrapper/Encoding.php') diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index d1e0622808b..4e81588de80 100644 --- a/lib/private/Files/Storage/Wrapper/Encoding.php +++ b/lib/private/Files/Storage/Wrapper/Encoding.php @@ -534,4 +534,8 @@ class Encoding extends Wrapper { public function getMetaData($path) { return $this->storage->getMetaData($this->findPathToUse($path)); } + + public function getDirectoryContent($directory): \Traversable { + return $this->storage->getDirectoryContent($this->findPathToUse($directory)); + } } -- cgit v1.2.3