From f1928e42bf1f0abe99cdf7c2b955c76445825aab Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 29 Sep 2013 23:07:59 +0000 Subject: [PATCH] MD5 file verification: Prevent md5_file() warnings when files don't exist, additionally, don't verify wp-content files as they can be updated separately, as well as WP_CONTENT_DIR being set elsewhere. See #22704 See #18201 git-svn-id: https://develop.svn.wordpress.org/trunk@25648 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-upgrader.php | 5 ++++- src/wp-admin/includes/update-core.php | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index 9f99cfc11a..22b26ac519 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -1357,7 +1357,10 @@ class Core_Upgrader extends WP_Upgrader { return false; foreach ( $checksums[ $wp_version ] as $file => $checksum ) { - if ( md5_file( ABSPATH . $file ) !== $checksum ) + // Skip files which get updated + if ( 'wp-content' == substr( $file, 0, 10 ) ) + continue; + if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) return false; } diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index a4eecf4f92..1d228956c6 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -698,7 +698,9 @@ function update_core($from, $to) { $checksums = get_core_checksums( $wp_version ); if ( ! empty( $checksums[ $wp_version ] ) && is_array( $checksums[ $wp_version ] ) ) { foreach( $checksums[ $wp_version ] as $file => $checksum ) { - if ( md5_file( ABSPATH . $file ) === $checksum ) + if ( 'wp-content' == substr( $file, 0, 10 ) ) + continue; + if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) === $checksum ) $skip[] = $file; } }