mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-21 23:11:53 +01:00
Upgrader: Copy wp-includes/version.php over last, to avoid an installation failing with the new version.php in place. Fixes #25860
Built from https://develop.svn.wordpress.org/trunk@27336 git-svn-id: http://core.svn.wordpress.org/trunk@27188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c01c33a6aa
commit
c94a32b0ad
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user