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
This commit is contained in:
Dion Hulse 2013-10-16 15:20:10 +00:00
parent ba0ebf3736
commit 8c35982ae8
1 changed files with 6 additions and 4 deletions

View File

@ -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().