Changeset 12723
- Timestamp:
- 01/14/2010 09:23:53 AM (16 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 5 edited
-
class-wp-filesystem-direct.php (modified) (1 diff)
-
class-wp-filesystem-ftpext.php (modified) (2 diffs)
-
class-wp-filesystem-ftpsockets.php (modified) (2 diffs)
-
class-wp-filesystem-ssh2.php (modified) (1 diff)
-
file.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-filesystem-direct.php
r11934 r12723 55 55 * Write a string to a file 56 56 * 57 * @param $file string Path to the file where to write the data.57 * @param $file string Remote path to the file where to write the data. 58 58 * @param $contents string The data to write. 59 59 * @param $mode int (optional) The file permissions as octal number, usually 0644. 60 * @param $type string (optional) Specifies additional type of access you require to the file.61 60 * @return bool False upon failure. 62 61 */ 63 function put_contents($file, $contents, $mode = false , $type = '') {64 if ( ! ($fp = @fopen($file, 'w' . $type)) )62 function put_contents($file, $contents, $mode = false ) { 63 if ( ! ($fp = @fopen($file, 'w')) ) 65 64 return false; 66 65 @fwrite($fp, $contents); -
trunk/wp-admin/includes/class-wp-filesystem-ftpext.php
r12369 r12723 112 112 return explode("\n", $this->get_contents($file)); 113 113 } 114 function put_contents($file, $contents, $type = '' ) { 115 if ( empty($type) ) 116 $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII; 117 114 115 function put_contents($file, $contents, $mode = false ) { 118 116 $temp = tmpfile(); 119 117 if ( ! $temp ) … … 123 121 fseek($temp, 0); //Skip back to the start of the file being written to 124 122 123 $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII; 125 124 $ret = @ftp_fput($this->link, $file, $temp, $type); 126 125 127 126 fclose($temp); 127 128 $this->chmod($file, $mode); 129 128 130 return $ret; 129 131 } -
trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php
r12104 r12723 116 116 } 117 117 118 function put_contents($file, $contents, $type = '' ) { 119 if ( empty($type) ) 120 $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII; 121 122 $this->ftp->SetType($type); 123 118 function put_contents($file, $contents, $mode = false ) { 124 119 $temp = wp_tempnam( $file ); 125 if ( ! $temphandle = fopen($temp, 'w+') ) {120 if ( ! $temphandle = @fopen($temp, 'w+') ) { 126 121 unlink($temp); 127 122 return false; … … 131 126 fseek($temphandle, 0); //Skip back to the start of the file being written to 132 127 128 $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII; 129 $this->ftp->SetType($type); 130 133 131 $ret = $this->ftp->fput($file, $temphandle); 134 132 135 133 fclose($temphandle); 136 134 unlink($temp); 135 136 $this->chmod($file, $mode); 137 137 138 return $ret; 138 139 } -
trunk/wp-admin/includes/class-wp-filesystem-ssh2.php
r11934 r12723 161 161 } 162 162 163 function put_contents($file, $contents, $type = '' ) { 164 $file = ltrim($file, '/'); 165 return false !== file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents); 163 function put_contents($file, $contents, $mode = false ) { 164 $file = ltrim($file, '/'); 165 $ret = file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents); 166 167 $this->chmod($file, $mode); 168 169 return false !== $ret; 166 170 } 167 171 -
trunk/wp-admin/includes/file.php
r12544 r12723 551 551 // We've made sure the folders are there, so let's extract the file now: 552 552 if ( ! $file['folder'] ) { 553 if ( !$fs->put_contents( $to . $file['filename'], $file['content'] ) )553 if ( !$fs->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) ) 554 554 return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']); 555 $fs->chmod($to . $file['filename'], FS_CHMOD_FILE);556 555 } 557 556 }
Note: See TracChangeset
for help on using the changeset viewer.