Index: wp-admin/includes/class-wp-filesystem-direct.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-direct.php	(revision 12371)
+++ wp-admin/includes/class-wp-filesystem-direct.php	(working copy)
@@ -54,14 +54,13 @@
 	/**
 	 * Write a string to a file
 	 *
-	 * @param $file string Path to the file where to write the data.
+	 * @param $file string Remote path to the file where to write the data.
 	 * @param $contents string The data to write.
 	 * @param $mode int (optional) The file permissions as octal number, usually 0644.
-	 * @param $type string (optional) Specifies additional type of access you require to the file.
 	 * @return bool False upon failure.
 	 */
-	function put_contents($file, $contents, $mode = false, $type = '') {
-		if ( ! ($fp = @fopen($file, 'w' . $type)) )
+	function put_contents($file, $contents, $mode = false ) {
+		if ( ! ($fp = @fopen($file, 'w')) )
 			return false;
 		@fwrite($fp, $contents);
 		@fclose($fp);
Index: wp-admin/includes/class-wp-filesystem-ftpext.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-ftpext.php	(revision 12371)
+++ wp-admin/includes/class-wp-filesystem-ftpext.php	(working copy)
@@ -111,10 +111,8 @@
 	function get_contents_array($file) {
 		return explode("\n", $this->get_contents($file));
 	}
-	function put_contents($file, $contents, $type = '' ) {
-		if ( empty($type) )
-			$type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
-
+	
+	function put_contents($file, $contents, $mode = false ) {
 		$temp = tmpfile();
 		if ( ! $temp )
 			return false;
@@ -122,9 +120,13 @@
 		fwrite($temp, $contents);
 		fseek($temp, 0); //Skip back to the start of the file being written to
 
+		$type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
 		$ret = @ftp_fput($this->link, $file, $temp, $type);
 
 		fclose($temp);
+
+		$this->chmod($file, $mode);
+
 		return $ret;
 	}
 	function cwd() {
Index: wp-admin/includes/class-wp-filesystem-ftpsockets.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-ftpsockets.php	(revision 12371)
+++ wp-admin/includes/class-wp-filesystem-ftpsockets.php	(working copy)
@@ -115,14 +115,9 @@
 		return explode("\n", $this->get_contents($file) );
 	}
 
-	function put_contents($file, $contents, $type = '' ) {
-		if ( empty($type) )
-			$type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
-
-		$this->ftp->SetType($type);
-
+	function put_contents($file, $contents, $mode = false ) {
 		$temp = wp_tempnam( $file );
-		if ( ! $temphandle = fopen($temp, 'w+') ) {
+		if ( ! $temphandle = @fopen($temp, 'w+') ) {
 			unlink($temp);
 			return false;
 		}
@@ -130,10 +125,16 @@
 		fwrite($temphandle, $contents);
 		fseek($temphandle, 0); //Skip back to the start of the file being written to
 
+		$type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
+		$this->ftp->SetType($type);
+
 		$ret = $this->ftp->fput($file, $temphandle);
 
 		fclose($temphandle);
 		unlink($temp);
+
+		$this->chmod($file, $mode);
+
 		return $ret;
 	}
 
Index: wp-admin/includes/class-wp-filesystem-ssh2.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-ssh2.php	(revision 12371)
+++ wp-admin/includes/class-wp-filesystem-ssh2.php	(working copy)
@@ -160,9 +160,13 @@
 		return file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
 	}
 
-	function put_contents($file, $contents, $type = '' ) {
+	function put_contents($file, $contents, $mode = false ) {
 		$file = ltrim($file, '/');
-		return false !== file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
+		$ret = file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
+		
+		$this->chmod($file, $mode);
+		
+		return false !== $ret;
 	}
 
 	function cwd() {
Index: wp-admin/includes/file.php
===================================================================
--- wp-admin/includes/file.php	(revision 12371)
+++ wp-admin/includes/file.php	(working copy)
@@ -546,9 +546,8 @@
 
 		// We've made sure the folders are there, so let's extract the file now:
 		if ( ! $file['folder'] ) {
-			if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
+			if ( !$fs->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) )
 				return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
-			$fs->chmod($to . $file['filename'], FS_CHMOD_FILE);
 		}
 	}
 	return true;

