mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-14 05:40:30 +00:00
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 git-svn-id: https://develop.svn.wordpress.org/trunk@25540 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -723,17 +723,9 @@ function copy_dir($from, $to, $skip_list = array() ) {
|
||||
$from = trailingslashit($from);
|
||||
$to = trailingslashit($to);
|
||||
|
||||
$skip_regex = '';
|
||||
foreach ( (array)$skip_list as $key => $skip_file )
|
||||
$skip_regex .= preg_quote($skip_file, '!') . '|';
|
||||
|
||||
if ( !empty($skip_regex) )
|
||||
$skip_regex = '!(' . rtrim($skip_regex, '|') . ')$!i';
|
||||
|
||||
foreach ( (array) $dirlist as $filename => $fileinfo ) {
|
||||
if ( !empty($skip_regex) )
|
||||
if ( preg_match($skip_regex, $from . $filename) )
|
||||
continue;
|
||||
if ( in_array( $filename, $skip_list ) )
|
||||
continue;
|
||||
|
||||
if ( 'f' == $fileinfo['type'] ) {
|
||||
if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
|
||||
@@ -747,7 +739,15 @@ function copy_dir($from, $to, $skip_list = array() ) {
|
||||
if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
|
||||
return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename);
|
||||
}
|
||||
$result = copy_dir($from . $filename, $to . $filename, $skip_list);
|
||||
|
||||
// generate the $sub_skip_list for the subdirectory as a sub-set of the existing $skip_list
|
||||
$sub_skip_list = array();
|
||||
foreach ( $skip_list as $skip_item ) {
|
||||
if ( 0 === strpos( $skip_item, $filename . '/' ) )
|
||||
$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
|
||||
}
|
||||
|
||||
$result = copy_dir($from . $filename, $to . $filename, $sub_skip_list);
|
||||
if ( is_wp_error($result) )
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user