diff --git src/wp-admin/includes/class-wp-upgrader.php src/wp-admin/includes/class-wp-upgrader.php
index 6ee7684c35..a2687b0a02 100644
|
|
|
class WP_Upgrader {
|
| 343 | 343 | $unwritable_files = array(); |
| 344 | 344 | |
| 345 | 345 | $_files = $wp_filesystem->dirlist( $remote_destination, true, true ); |
| | 346 | $_flat_files = array(); |
| 346 | 347 | |
| 347 | | // Flatten the resulting array, iterate using each as we append to the array during iteration. |
| 348 | | while ( $f = each( $_files ) ) { |
| 349 | | $file = $f['value']; |
| 350 | | $name = $f['key']; |
| | 348 | // @TODO needs testing: |
| 351 | 349 | |
| | 350 | // Flatten the resulting array. |
| | 351 | foreach ( $_files as $name => $file ) { |
| 352 | 352 | if ( ! isset( $file['files'] ) ) { |
| 353 | 353 | continue; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | foreach ( $file['files'] as $filename => $details ) { |
| 357 | | $_files[ $name . '/' . $filename ] = $details; |
| | 357 | $_flat_files[ $name . '/' . $filename ] = $details; |
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | // Check writability. |
| 362 | | foreach ( $_files as $filename => $file_details ) { |
| | 362 | foreach ( $_flat_files as $filename => $file_details ) { |
| 363 | 363 | if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) { |
| 364 | 364 | |
| 365 | 365 | // Attempt to alter permissions to allow writes and try again. |