From 67c80dae1375b76e929cc08ac980deda8e802b12 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 14 Oct 2013 21:14:39 +0000 Subject: [PATCH] Account for the possible failure of disk_free_space() in update_core(). see #22704, #25576. git-svn-id: https://develop.svn.wordpress.org/trunk@25778 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/update-core.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index f1ea1e5389..c7097dc9f0 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -740,8 +740,10 @@ function update_core($from, $to) { foreach ( $failed as $file ) $total_size += filesize( $working_dir_local . '/' . $file ); - // If we don't have enough free space, it isn't worth trying again - if ( $total_size >= disk_free_space( ABSPATH ) ) { + // If we don't have enough free space, it isn't worth trying again. + // Unlikely to be hit due to the check in unzip_file(). + $available_space = disk_free_space( ABSPATH ); + if ( $available_space && $total_size >= $available_space ) { $result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ), $to ); } else { $result = _copy_dir( $from . $distro, $to, $skip );