Make WordPress Core

Opened 23 months ago

Last modified 5 hours ago

#53659 new enhancement

Optional skipping of hidden files/folders in list_files

Reported by: yaniiliev's profile yani.iliev 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)

#1 @yani.iliev
23 months ago

  • Type changed from defect (bug) to enhancement

#2 @sabernhardt
20 months ago

  • Component changed from General to Filesystem API

This ticket was mentioned in PR #4223 on WordPress/wordpress-develop by @costdev.


3 months ago
#3

  • Keywords has-patch has-unit-tests added

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

#4 @costdev
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 to true.
  • However, this new parameter in list_files() defaults to false for backward compatibility.

  • Hidden file exclusion was introduced in [41806]. See this comment. Setting the Version property to 4.9.
  • Milestoning this ticket for 6.3.
Last edited 3 months ago by costdev (previous) (diff)

This ticket was mentioned in Slack in #core by oglekler. View the logs.


5 hours ago

#6 @rutviksavsani
5 hours ago

  • Keywords needs-testing-info needs-testing added

This ticket was discussed in the recent bug scrub.
It seems we need testing instructions/info and testing the PR.

Note: See TracTickets for help on using tickets.