From 549029393f06b76aec1fd6dd76203c6cee0eaed5 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Wed, 16 Oct 2013 15:19:59 +0000 Subject: [PATCH] Avoid a few PHP Warnings when files don't exist and use a better method to locate the local filepath. See #18201 git-svn-id: https://develop.svn.wordpress.org/trunk@25811 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/update-core.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index 55d035c010..267d8ee157 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -754,7 +754,7 @@ function update_core($from, $to) { if ( 0 === strpos( $file, 'wp-content' ) ) continue; - if ( md5_file( ABSPATH . $file ) == $checksum ) + if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) == $checksum ) $skip[] = $file; else $failed[] = $file; @@ -765,9 +765,11 @@ function update_core($from, $to) { if ( ! empty( $failed ) ) { $total_size = 0; // Find the local version of the working directory - $working_dir_local = str_replace( trailingslashit( $wp_filesystem->wp_content_dir() ), trailingslashit( WP_CONTENT_DIR ), $from . $distro ); - foreach ( $failed as $file ) - $total_size += filesize( $working_dir_local . '/' . $file ); + $working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro; + foreach ( $failed as $file ) { + if ( file_exists( $working_dir_local . $file ) ) + $total_size += filesize( $working_dir_local . $file ); + } // 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().