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:
parent
144a8ad8ce
commit
53062d6414
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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) )
|
||||
|
|
Loading…
Reference in New Issue