Make WordPress Core

Ticket #25860: 25860.diff

File 25860.diff, 1.5 KB (added by dd32, 12 years ago)
  • src/wp-admin/includes/update-core.php

     
    748748        apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );
    749749
    750750        // Don't copy wp-content, we'll deal with that below
    751         $skip = array( 'wp-content' );
     751        // We also copy version.php last so failed updates report their old version
     752        $skip = array( 'wp-content', 'wp-includes/version.php' );
    752753        $check_is_writable = array();
    753754
    754755        // Check to see which files don't really need updating - only available for 3.7 and higher
     
    810811        if ( is_wp_error( $result ) )
    811812                $result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
    812813
     814        // Since we know the core files have copied over, we can now copy the version file
     815        if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php' ) ) {
     816                 $wp_filesystem->delete( $from, true );
     817                 return new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' );
     818        }
     819        $wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
     820
    813821        // Check to make sure everything copied correctly, ignoring the contents of wp-content
    814822        $skip = array( 'wp-content' );
    815823        $failed = array();