wp-admin/includes/class-wp-filesystem-ftpsockets.php:713Gets details for files in a directory or a specific file.
$pathstringoptional'.'$recursivebooloptionalfalsearray|false...$0array
$namestring
$permsstring
$permsnstring
$numberint|string|false
$ownerstring|false
$groupstring|false
$sizeint|string|false
$lastmodunixint|string|false
$lastmodstring|false
$timeint|string|false
$typestring
$filesarray|false
public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { if ( $this->is_file( $path ) ) { $limit_file = basename( $path ); $path = dirname( $path ) . '/'; } else { $limit_file = false; } mbstring_binary_safe_encoding(); /** @var array<string, FileListing>|false $list */ $list = $this->ftp->dirlist( $path ); if ( ! is_array( $list ) || ( empty( $list ) && ! $this->exists( $path ) ) ) { reset_mbstring_encoding(); return false; } $path = trailingslashit( $path ); $ret = array(); foreach ( $list as $struc ) { if ( '.' === $struc['name'] || '..' === $struc['name'] ) { continue; } if ( ! $include_hidden && '.' === $struc['name'][0] ) { continue; } if ( $limit_file && $struc['name'] !== $limit_file ) { continue; } if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( $path . $struc['name'], $include_hidden, $recursive ); } else { $struc['files'] = array(); } } // Replace symlinks formatted as "source -> target" with just the source name. if ( $struc['islink'] ?? false ) { $struc['name'] = (string) preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] ); } // Add the octal representation of the file permissions. if ( isset( $struc['perms'] ) ) { $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); } $ret[ $struc['name'] ] = $struc; } reset_mbstring_encoding(); return $ret; }Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-admin/includes/class-wp-filesystem-ftpsockets.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.