Opened 23 months ago
Last modified 5 hours ago
#53659 new enhancement
Optional skipping of hidden files/folders in list_files
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Filesystem API | Keywords: | has-patch has-unit-tests needs-testing-info needs-testing |
Focuses: | Cc: |
Description
The function always skips hidden files/folders that begin with a dot (.
)
This allows for files like .htaccess
and .git
to be skipped when listing a folder.
This ticket is about allow to suppress this behavior in the function and return hidden files/folders that begin with a dot (.
).
One possible solution is to add a new argument to the function so that the function is defined as such:
function list_files( $folder = '', $levels = 100, $exclusions = array(), $skip_dots = true )
Change History (6)
This ticket was mentioned in PR #4223 on WordPress/wordpress-develop by @costdev.
3 months ago
#3
- Keywords has-patch has-unit-tests added
#4
@
3 months ago
- Milestone changed from Awaiting Review to 6.3
- Version set to 4.9
- PR 4223 introduces the
$include_hidden
parameter to allow the inclusion of hidden ("." prefixed) files. - The parameter name
$include_hidden
is used as this is consistent with the parameter name used in the::dirlist()
filesystem abstraction classes, which defaults totrue
. - However, this new parameter in
list_files()
defaults tofalse
for backward compatibility.
- Hidden file exclusion was introduced in [41806]. See this comment. Setting the
Version
property to4.9
. - Milestoning this ticket for 6.3.
This ticket was mentioned in Slack in #core by oglekler. View the logs.
5 hours ago
Note: See
TracTickets for help on using
tickets.
This adds a new optional
$include_hidden
parameter to allow the inclusion of hidden ("." prefixed) files.Defaults to
false
for backward compatibility.Trac ticket: https://core.trac.wordpress.org/ticket/53659