Make WordPress Core


Ignore:
Timestamp:
09/21/2013 06:48:20 AM (11 years ago)
Author:
dd32
Message:

Upgrader: Perform a MD5 file verification check on the files during upgrade. This ensures that both a Partial upgrade build can be used, and that all the files were copied into place correctly.
Props pento for initial patch. Fixes #18201

File:
1 edited

Legend:

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

    r25469 r25540  
    724724    $to = trailingslashit($to);
    725725
    726     $skip_regex = '';
    727     foreach ( (array)$skip_list as $key => $skip_file )
    728         $skip_regex .= preg_quote($skip_file, '!') . '|';
    729 
    730     if ( !empty($skip_regex) )
    731         $skip_regex = '!(' . rtrim($skip_regex, '|') . ')$!i';
    732 
    733726    foreach ( (array) $dirlist as $filename => $fileinfo ) {
    734         if ( !empty($skip_regex) )
    735             if ( preg_match($skip_regex, $from . $filename) )
    736                 continue;
     727        if ( in_array( $filename, $skip_list ) )
     728            continue;
    737729
    738730        if ( 'f' == $fileinfo['type'] ) {
     
    748740                    return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename);
    749741            }
    750             $result = copy_dir($from . $filename, $to . $filename, $skip_list);
     742
     743            // generate the $sub_skip_list for the subdirectory as a sub-set of the existing $skip_list
     744            $sub_skip_list = array();
     745            foreach ( $skip_list as $skip_item ) {
     746                if ( 0 === strpos( $skip_item, $filename . '/' ) )
     747                    $sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
     748            }
     749
     750            $result = copy_dir($from . $filename, $to . $filename, $sub_skip_list);
    751751            if ( is_wp_error($result) )
    752752                return $result;
Note: See TracChangeset for help on using the changeset viewer.