Filesystem API: Don't add '.' to the list of directories which need to be checked/created when extracting a file.

Prevents a PHP warning by `WP_Filesystem_Direct::mkdir()` when installing a language pack which doesn't have subdirectories.

Props tfrommen.
Fixes #36570.

git-svn-id: https://develop.svn.wordpress.org/trunk@37421 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-05-12 12:39:49 +00:00
parent 8d6d88ffbb
commit 954eeba053

View File

@ -643,10 +643,13 @@ function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) {
$uncompressed_size += $info['size'];
if ( '/' == substr($info['name'], -1) ) // directory
$needed_dirs[] = $to . untrailingslashit($info['name']);
else
$needed_dirs[] = $to . untrailingslashit(dirname($info['name']));
if ( '/' === substr( $info['name'], -1 ) ) {
// Directory.
$needed_dirs[] = $to . untrailingslashit( $info['name'] );
} elseif ( '.' !== $dirname = dirname( $info['name'] ) ) {
// Path to a file.
$needed_dirs[] = $to . untrailingslashit( $dirname );
}
}
/*