WP_Filesyste: SSH2 PHP Extension support: Fix a case where defining a custom FS_CHMOD_FILE / FS_CHMOD_DIR constant wouldn't take effect due to chmod() failing with a invalid path. Fixes #23589

Built from https://develop.svn.wordpress.org/trunk@25306


git-svn-id: http://core.svn.wordpress.org/trunk@25268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2013-09-09 03:05:09 +00:00
parent 7a6fad844a
commit 023a4c7336

View File

@ -161,8 +161,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
}
function put_contents($file, $contents, $mode = false ) {
$file = ltrim($file, '/');
$ret = file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
$ret = file_put_contents( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ), $contents );
if ( $ret !== strlen( $contents ) )
return false;