X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/a6f44f0edcda2471c5a33e4156c1c9488c7f3210..refs/tags/wordpress-3.7:/wp-admin/includes/class-wp-filesystem-ssh2.php?ds=sidebyside diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php index 8ff3cb18..f942989d 100644 --- a/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -1,13 +1,6 @@ sftp_link . '/' . $file); } @@ -161,12 +154,14 @@ 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; $this->chmod($file, $mode); - return false !== $ret; + return true; } function cwd() { @@ -206,7 +201,17 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { return $this->run_command(sprintf('chmod -R %o %s', $mode, escapeshellarg($file)), true); } - function chown($file, $owner, $recursive = false ) { + /** + * Change the ownership of a file / folder. + * + * @since Unknown + * + * @param string $file Path to the file. + * @param mixed $owner A user name or number. + * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False. + * @return bool Returns true on success or false on failure. + */ + function chown( $file, $owner, $recursive = false ) { if ( ! $this->exists($file) ) return false; if ( ! $recursive || ! $this->is_dir($file) )