WP_Filesystem_*::mkdir() untrailingslash path consistently, don't waste time attempting to create an "empty" path. See #15575. Props lordandrei and SergeyBiryukov for initial patches.

git-svn-id: https://develop.svn.wordpress.org/trunk@18964 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2011-10-13 10:43:38 +00:00
parent 45e3751dc9
commit b158ddc175
4 changed files with 12 additions and 1 deletions

View File

@ -287,7 +287,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
// safe mode fails with a trailing slash under certain PHP versions.
$path = untrailingslashit($path);
if ( empty($path) )
$path = '/';
return false;
if ( ! $chmod )
$chmod = FS_CHMOD_DIR;

View File

@ -247,6 +247,10 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
return false;
}
function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
$path = untrailingslashit($path);
if ( empty($path) )
return false;
if ( !@ftp_mkdir($this->link, $path) )
return false;
$this->chmod($path, $chmod);

View File

@ -267,6 +267,10 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
}
function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) {
$path = untrailingslashit($path);
if ( empty($path) )
return false;
if ( ! $this->ftp->mkdir($path) )
return false;
if ( ! $chmod )

View File

@ -311,6 +311,9 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
$path = untrailingslashit($path);
if ( empty($path) )
return false;
if ( ! $chmod )
$chmod = FS_CHMOD_DIR;
if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) )