Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleFS: Add getFullDirectoryListing for complete directory listing #50145

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/private/Files/SimpleFS/SimpleFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
8 changes: 8 additions & 0 deletions lib/public/Files/SimpleFS/ISimpleFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ interface ISimpleFolder {
*/
public function getDirectoryListing(): array;

/**
* Get all the files and folders in a folder
*
* @return (ISimpleFile[] || ISimpleFolder[])
* @since 30.0.5
*/
public function getFullDirectoryListing(): array;

/**
* Check if a file with $name exists
*
Expand Down