diff --git a/lib/private/Files/SimpleFS/SimpleFolder.php b/lib/private/Files/SimpleFS/SimpleFolder.php index 0da552e402b72..41fdd2b1bf2ff 100644 --- a/lib/private/Files/SimpleFS/SimpleFolder.php +++ b/lib/private/Files/SimpleFS/SimpleFolder.php @@ -44,6 +44,21 @@ public function getDirectoryListing(): array { return array_values($fileListing); } + public function getFullDirectoryListing(): array { + $listing = $this->folder->getDirectoryListing(); + + $nodeListing = array_map(function (Node $node) { + if ($node instanceof File) { + return new SimpleFile($node); + } elseif ($node instanceof Folder) { + return new SimpleFolder($node); + } + return null; + }, $listing); + + return array_values(array_filter($nodeListing)); + } + public function delete(): void { $this->folder->delete(); } diff --git a/lib/public/Files/SimpleFS/ISimpleFolder.php b/lib/public/Files/SimpleFS/ISimpleFolder.php index 79b9fca1dac2e..83266ea08dd93 100644 --- a/lib/public/Files/SimpleFS/ISimpleFolder.php +++ b/lib/public/Files/SimpleFS/ISimpleFolder.php @@ -22,6 +22,14 @@ interface ISimpleFolder { */ public function getDirectoryListing(): array; + /** + * Get all the Files and Folder in a folder + * + * @return (ISimpleFile[] || ISimpleFolder[]) + * @since 30.0.5 + */ + public function getFullDirectoryListing(): array; + /** * Check if a file with $name exists *