Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-04-05 16:29:49 +0300
committerRobin Appelman <robin@icewind.nl>2022-04-06 15:40:34 +0300
commit151c80039751bbe74042d7f6f5d58e9f115064e4 (patch)
tree6345e06bc32e6b8392bc63f10bca1a35f5ee75c6 /lib/private/Files/View.php
parent9b1abd6fac90b97527c8db9d9119979c7753cb8c (diff)
allow reusing known folder info when getting directory contents
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/View.php')
-rw-r--r--lib/private/Files/View.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index e23dd4312aa..eef87cc65f4 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1431,7 +1431,7 @@ class View {
* @param string $mimetype_filter limit returned content to this mimetype or mimepart
* @return FileInfo[]
*/
- public function getDirectoryContent($directory, $mimetype_filter = '') {
+ public function getDirectoryContent($directory, $mimetype_filter = '', \OCP\Files\FileInfo $directoryInfo = null) {
$this->assertPathLength($directory);
if (!Filesystem::isValidPath($directory)) {
return [];
@@ -1449,14 +1449,21 @@ class View {
$cache = $storage->getCache($internalPath);
$user = \OC_User::getUser();
- $data = $this->getCacheEntry($storage, $internalPath, $directory);
+ if (!$directoryInfo) {
+ $data = $this->getCacheEntry($storage, $internalPath, $directory);
+ if (!$data instanceof ICacheEntry || !isset($data['fileid'])) {
+ return [];
+ }
+ } else {
+ $data = $directoryInfo;
+ }
- if (!$data instanceof ICacheEntry || !isset($data['fileid']) || !($data->getPermissions() & Constants::PERMISSION_READ)) {
- return [];
- }
+ if (!($data->getPermissions() & Constants::PERMISSION_READ)) {
+ return [];
+ }
- $folderId = $data['fileid'];
- $contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter
+ $folderId = $data->getId();
+ $contents = $cache->getFolderContentsById($folderId); //TODO: mimetype_filter
$sharingDisabled = \OCP\Util::isSharingDisabledForUser();