mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user