diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index e42162d0d4..7100524ea4 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -290,8 +290,16 @@ function update_core($from, $to) { // Sanity check the unzipped distribution apply_filters('update_feedback', __('Verifying the unpacked files…')); - if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') || - !$wp_filesystem->exists($from . '/wordpress/wp-includes/functions.php') ) { + $distro = ''; + $roots = array( '/wordpress', '/wordpress-mu' ); + foreach( $roots as $root ) { + if ( $wp_filesystem->exists($from . $root . '/wp-settings.php') && $wp_filesystem->exists($from . $root . '/wp-admin/admin.php') && + !$wp_filesystem->exists($from . $root . '/wp-includes/functions.php') ) { + $distro = $root; + break; + } + } + if ( !$distro ) { $wp_filesystem->delete($from, true); return new WP_Error('insane_distro', __('The update could not be unpacked') ); } @@ -305,7 +313,7 @@ function update_core($from, $to) { $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); // Copy new versions of WP files into place. - $result = copy_dir($from . '/wordpress', $to); + $result = copy_dir($from . $distro, $to); if ( is_wp_error($result) ) { $wp_filesystem->delete($maintenance_file); $wp_filesystem->delete($from, true);