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:
parent
fc81fef986
commit
70e9f5b543
|
@ -116,11 +116,16 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||||
$tempfile = wp_tempnam($file);
|
$tempfile = wp_tempnam($file);
|
||||||
$temp = fopen($tempfile, 'w+');
|
$temp = fopen($tempfile, 'w+');
|
||||||
|
|
||||||
if ( ! $temp )
|
if ( ! $temp ) {
|
||||||
|
unlink( $tempfile );
|
||||||
return false;
|
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;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
fseek( $temp, 0 ); // Skip back to the start of the file being written to
|
fseek( $temp, 0 ); // Skip back to the start of the file being written to
|
||||||
$contents = '';
|
$contents = '';
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue