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

git-svn-id: https://develop.svn.wordpress.org/trunk@27336 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2014-03-01 06:00:47 +00:00
parent 1276f69288
commit 14b4579d98
1 changed files with 11 additions and 1 deletions

View File

@ -748,7 +748,8 @@ function update_core($from, $to) {
apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );
// Don't copy wp-content, we'll deal with that below
$skip = array( 'wp-content' );
// We also copy version.php last so failed updates report their old version
$skip = array( 'wp-content', 'wp-includes/version.php' );
$check_is_writable = array();
// Check to see which files don't really need updating - only available for 3.7 and higher
@ -810,6 +811,15 @@ function update_core($from, $to) {
if ( is_wp_error( $result ) )
$result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
// Since we know the core files have copied over, we can now copy the version file
if ( ! is_wp_error( $result ) ) {
if ( ! $r = $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) {
$wp_filesystem->delete( $from, true );
$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' );
}
$wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
}
// Check to make sure everything copied correctly, ignoring the contents of wp-content
$skip = array( 'wp-content' );
$failed = array();