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

Built from https://develop.svn.wordpress.org/trunk@25648


git-svn-id: http://core.svn.wordpress.org/trunk@25565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2013-09-29 23:08:09 +00:00
parent 6e9ba8be22
commit 7ed4059230
2 changed files with 7 additions and 2 deletions

View File

@ -1357,7 +1357,10 @@ class Core_Upgrader extends WP_Upgrader {
return false; return false;
foreach ( $checksums[ $wp_version ] as $file => $checksum ) { 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; return false;
} }

View File

@ -698,7 +698,9 @@ function update_core($from, $to) {
$checksums = get_core_checksums( $wp_version ); $checksums = get_core_checksums( $wp_version );
if ( ! empty( $checksums[ $wp_version ] ) && is_array( $checksums[ $wp_version ] ) ) { if ( ! empty( $checksums[ $wp_version ] ) && is_array( $checksums[ $wp_version ] ) ) {
foreach( $checksums[ $wp_version ] as $file => $checksum ) { 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; $skip[] = $file;
} }
} }