WordPress.org

Make WordPress Core

Ticket #13625: 13625.diff

File 13625.diff, 1.9 KB (added by ryan, 5 years ago)
  • wp-admin/includes/update-core.php

     
    266266 * @return WP_Error|null WP_Error on failure, null on success. 
    267267 */ 
    268268function update_core($from, $to) { 
    269         global $wp_filesystem, $_old_files, $wpdb; 
     269        global $wp_filesystem, $_old_files, $wpdb, $wpmu_version; 
    270270 
    271271        @set_time_limit( 300 ); 
    272272 
     
    288288        elseif ( !$mysql_compat ) 
    289289                return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) ); 
    290290 
     291        if ( isset($wpmu_version) ) 
     292                $wp_dir = 'wordpress-mu'; 
     293        else 
     294                $wp_dir = 'wordpress'; 
     295 
    291296        // Sanity check the unzipped distribution 
    292297        apply_filters('update_feedback', __('Verifying the unpacked files…')); 
    293         if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') || 
    294                 !$wp_filesystem->exists($from . '/wordpress/wp-includes/functions.php') ) { 
     298        if ( !$wp_filesystem->exists($from . "/$wp_dir/wp-settings.php") || !$wp_filesystem->exists($from . "/$wp_dir/wp-admin/admin.php") || 
     299                !$wp_filesystem->exists($from . "/$wp_dir/wp-includes/functions.php") ) { 
    295300                $wp_filesystem->delete($from, true); 
    296301                return new WP_Error('insane_distro', __('The update could not be unpacked') ); 
    297302        } 
     
    305310        $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); 
    306311 
    307312        // Copy new versions of WP files into place. 
    308         $result = copy_dir($from . '/wordpress', $to); 
     313        $result = copy_dir($from . "/$wp_dir", $to); 
    309314        if ( is_wp_error($result) ) { 
    310315                $wp_filesystem->delete($maintenance_file); 
    311316                $wp_filesystem->delete($from, true);