Make WordPress Core


Ignore:
Timestamp:
03/01/2014 06:00:47 AM (12 years ago)
Author:
dd32
Message:

Upgrader: Copy wp-includes/version.php over last, to avoid an installation failing with the new version.php in place. Fixes #25860

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update-core.php

    r27195 r27336  
    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
     
    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 ( ! is_wp_error( $result ) ) {
     816        if ( ! $r = $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) {
     817            $wp_filesystem->delete( $from, true );
     818            $result = 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.' ), 'WTFwp-includes/version.php' );
     819        }
     820        $wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
     821    }
     822
    813823    // Check to make sure everything copied correctly, ignoring the contents of wp-content
    814824    $skip = array( 'wp-content' );
Note: See TracChangeset for help on using the changeset viewer.