Make WordPress Core

Changeset 35777


Ignore:
Timestamp:
12/06/2015 05:06:53 PM (9 years ago)
Author:
dd32
Message:

Upgrader: FTP: Cleanup temporary files during FTP download failures.
Props ruud@joyo
Fixes #34772

File:
1 edited

Legend:

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

    r35663 r35777  
    117117        $temp = fopen($tempfile, 'w+');
    118118
    119         if ( ! $temp )
    120             return false;
    121 
    122         if ( ! @ftp_fget($this->link, $temp, $file, FTP_BINARY ) )
    123             return false;
    124 
     119        if ( ! $temp ) {
     120            unlink( $tempfile );
     121            return false;
     122        }
     123       
     124        if ( ! @ftp_fget( $this->link, $temp, $file, FTP_BINARY ) ) {
     125            fclose( $temp );
     126            unlink( $tempfile );
     127            return false;
     128        }
     129       
    125130        fseek( $temp, 0 ); // Skip back to the start of the file being written to
    126131        $contents = '';
Note: See TracChangeset for help on using the changeset viewer.