-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Feature/files list occ command #43342
Feature/files list occ command #43342
Conversation
…e for files. path or --all is required to search files in the path or based on all users
…se in file info if no files in dir covered
@AndyScherzinger @sorbaugh Please find the above file list implemented based on files:scan. I am not able add you as reviewers so tagged both of you in the comment here. |
Psalm errors fixed Signed-off-by: yemkareems <[email protected]>
composer run cs:fix Signed-off-by: yemkareems <[email protected]>
exectime variable removed to fix psalm error Signed-off-by: yemkareems <[email protected]>
type hinting corrected Signed-off-by: yemkareems <[email protected]>
Scan files replaced with listFiles and all methods refactored accordingly Signed-off-by: yemkareems <[email protected]>
path made a argument and user extraction logic based on path changed Signed-off-by: yemkareems <[email protected]>
help doc content changed to start with all first caps Signed-off-by: yemkareems <[email protected]>
"name" => $node->getName(), | ||
"size" => $node->getSize() . " bytes", | ||
"perm" => $node->getPermissions(), | ||
"owner" => $node->getOwner()->getDisplayName(), |
Check notice
Code scanning / Psalm
PossiblyNullReference Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"owner" => $node->getOwner()->getDisplayName(), | |
"owner" => $node->getOwner()?->getDisplayName(), |
…hors removed removed the user loop since only one user is there and copy right authors removed Signed-off-by: yemkareems <[email protected]>
type hinting corrected Signed-off-by: yemkareems <[email protected]>
cs fix ran Signed-off-by: yemkareems <[email protected]>
Signed-off-by: yemkareems <[email protected]>
userFolder type hint to fix psalm error Signed-off-by: yemkareems <[email protected]>
Co-authored-by: Andy Scherzinger <[email protected]> Signed-off-by: yemkareems <[email protected]>
apps/files/lib/Command/ListFiles.php
Outdated
->addArgument( | ||
"path", | ||
InputArgument::REQUIRED, | ||
'Limit list to this path, eg. path="/alice/files/Music", the user_id is determined by the path parameter' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description no longer matches with it being moved to and argument. (the path=
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@icewind1991 Updated the description of the path argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the path=...
doesn't match anymore as it's no longer an option, so you no longer specify the path=
part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @icewind1991 not sure if i understood it correctly because i still do occ files:list path=/admin/files/Media --type=video where path is required and the above lists all the video files in the path
updated the description of path Signed-off-by: yemkareems <[email protected]>
making changes to list folders as directory type Signed-off-by: yemkareems <[email protected]>
cs fix run for the file Signed-off-by: yemkareems <[email protected]>
apps/files/lib/Command/ListFiles.php
Outdated
@@ -0,0 +1,301 @@ | |||
<?php | |||
/** | |||
* @copyright Copyright (c) 2024, ownCloud, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @copyright Copyright (c) 2024, ownCloud, Inc. | |
* @copyright Copyright (c) 2024 Kareem <[email protected]> |
"name" => $node->getName(), | ||
"size" => $node->getSize() . " bytes", | ||
"perm" => $node->getPermissions(), | ||
"owner" => $node->getOwner()->getDisplayName(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"owner" => $node->getOwner()->getDisplayName(), | |
"owner" => $node->getOwner()?->getDisplayName(), |
$files = $userFolder->getDirectoryListing(); | ||
foreach ($files as $file) { | ||
$includeType = $includeMin = $includeMax = true; | ||
$nodeInfo = $this->getNodeInfo($file); |
Check notice
Code scanning / Psalm
ArgumentTypeCoercion Note
Closing as it move here: #46352 |
files:list implemented based on files:scan
List of possible usage
all user based search
occ files:list --all
path based search
occ files:list --path /admin/files
scans the directory and sub directory also
Filter by type
Filter by file size
default sort order is desc
occ files:list --all --sort name
to do asc
occ files:list --all --sort name --order ASC
Non recursive scan and list
occ files:list --path /admin/files/ --shallow
The above does not scan sub directories recursively
All the above params can be combined to have different result sets
Summary
TODO
Checklist