From 8c35982ae8e3108cbcba4dd4059fda4feb83a396 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Wed, 16 Oct 2013 15:20:10 +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 Built from https://develop.svn.wordpress.org/trunk@25811 git-svn-id: http://core.svn.wordpress.org/trunk@25723 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/update-core.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 55d035c010..267d8ee157 100644 --- a/wp-admin/includes/update-core.php +++ b/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().