Upgrader: FTP: Cleanup temporary files during FTP download failures.

Props ruud@joyo
Fixes #34772

Built from https://develop.svn.wordpress.org/trunk@35777


git-svn-id: http://core.svn.wordpress.org/trunk@35741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2015-12-06 17:07:25 +00:00
parent fc81fef986
commit 70e9f5b543
2 changed files with 10 additions and 5 deletions

View File

@ -116,11 +116,16 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
$tempfile = wp_tempnam($file);
$temp = fopen($tempfile, 'w+');
if ( ! $temp )
if ( ! $temp ) {
unlink( $tempfile );
return false;
}
if ( ! @ftp_fget($this->link, $temp, $file, FTP_BINARY ) )
if ( ! @ftp_fget( $this->link, $temp, $file, FTP_BINARY ) ) {
fclose( $temp );
unlink( $tempfile );
return false;
}
fseek( $temp, 0 ); // Skip back to the start of the file being written to
$contents = '';

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-35776';
$wp_version = '4.5-alpha-35777';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.