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: http://svn.automattic.com/wordpress/trunk@18964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2011-10-13 10:43:38 +00:00
parent 144a8ad8ce
commit 53062d6414
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) )