Make WordPress Core


Ignore:
Timestamp:
01/14/2010 09:23:53 AM (16 years ago)
Author:
dd32
Message:

Standardise WP_Filesystem_*::put_contents() arguments to support chmod reliably across all transports. Fixes #10889

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r12104 r12723  
    116116    }
    117117
    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 ) {
    124119        $temp = wp_tempnam( $file );
    125         if ( ! $temphandle = fopen($temp, 'w+') ) {
     120        if ( ! $temphandle = @fopen($temp, 'w+') ) {
    126121            unlink($temp);
    127122            return false;
     
    131126        fseek($temphandle, 0); //Skip back to the start of the file being written to
    132127
     128        $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
     129        $this->ftp->SetType($type);
     130
    133131        $ret = $this->ftp->fput($file, $temphandle);
    134132
    135133        fclose($temphandle);
    136134        unlink($temp);
     135
     136        $this->chmod($file, $mode);
     137
    137138        return $ret;
    138139    }
Note: See TracChangeset for help on using the changeset viewer.