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
This commit is contained in:
Dion Hulse 2013-10-16 15:19:59 +00:00
parent e192eb396e
commit 549029393f
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().