X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/fa11948979fd6a4ea5705dc613b239699a459db3..42aebe6945a3a60c8f73853bea2c8b202d64a20b:/wp-admin/includes/update-core.php diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 52ef1fd4..913a9d4c 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -697,6 +697,9 @@ function update_core($from, $to) { // Check to see which files don't really need updating - only available for 3.7 and higher if ( function_exists( 'get_core_checksums' ) ) { + // Find the local version of the working directory + $working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro; + $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) $checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2 @@ -706,6 +709,8 @@ function update_core($from, $to) { continue; if ( ! file_exists( ABSPATH . $file ) ) continue; + if ( ! file_exists( $working_dir_local . $file ) ) + continue; if ( md5_file( ABSPATH . $file ) === $checksum ) $skip[] = $file; else @@ -750,11 +755,12 @@ function update_core($from, $to) { // Check to make sure everything copied correctly, ignoring the contents of wp-content $skip = array( 'wp-content' ); $failed = array(); - if ( is_array( $checksums ) ) { + if ( isset( $checksums ) && is_array( $checksums ) ) { foreach ( $checksums as $file => $checksum ) { - if ( 0 === strpos( $file, 'wp-content' ) ) + if ( 'wp-content' == substr( $file, 0, 10 ) ) + continue; + if ( ! file_exists( $working_dir_local . $file ) ) continue; - if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) == $checksum ) $skip[] = $file; else @@ -765,8 +771,6 @@ function update_core($from, $to) { // Some files didn't copy properly if ( ! empty( $failed ) ) { $total_size = 0; - // Find the local version of the working directory - $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 ); @@ -882,6 +886,11 @@ function update_core($from, $to) { $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); wp_remote_post($db_upgrade_url, array('timeout' => 60)); + // Clear the cache to prevent an update_option() from saving a stale db_version to the cache + wp_cache_flush(); + // (Not all cache backends listen to 'flush') + wp_cache_delete( 'alloptions', 'options' ); + // Remove working directory $wp_filesystem->delete($from, true);