WP_Filesystem: Ensure that all files are read/written correctly by verifying the return values from fwrite() and using FTP_BINARY mode (ASCII converts line endings as per the spec). See #25237

git-svn-id: https://develop.svn.wordpress.org/trunk@25304 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2013-09-09 02:42:52 +00:00
parent d92f3ab536
commit 2f40784d97
4 changed files with 42 additions and 30 deletions

View File

@@ -150,7 +150,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
return false;
}
function get_contents($file, $type = '', $resumepos = 0 ) {
function get_contents( $file ) {
$file = ltrim($file, '/');
return file_get_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file);
}
@@ -164,9 +164,12 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
$file = ltrim($file, '/');
$ret = file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
if ( $ret !== strlen( $contents ) )
return false;
$this->chmod($file, $mode);
return false !== $ret;
return true;
}
function cwd() {