diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index b9557b1..b69fd3f 100644
|
a
|
b
|
function download_url( $url ) { |
| 487 | 487 | |
| 488 | 488 | /** |
| 489 | 489 | * Unzip's a specified ZIP file to a location on the Filesystem via the WordPress Filesystem Abstraction. |
| 490 | | * Assumes that WP_Filesystem() has already been called and set up. |
| | 490 | * Assumes that WP_Filesystem() has already been called and set up. Does not extract a root-level __MACOSX directory, if present. |
| 491 | 491 | * |
| 492 | 492 | * Attempts to increase the PHP Memory limit to 256M before uncompressing, |
| 493 | 493 | * However, The most memory required shouldn't be much larger than the Archive itself. |
| … |
… |
function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) { |
| 560 | 560 | if ( ! $info = $z->statIndex($i) ) |
| 561 | 561 | return new WP_Error('stat_failed', __('Could not retrieve file from archive.')); |
| 562 | 562 | |
| | 563 | if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory |
| | 564 | continue; |
| | 565 | |
| 563 | 566 | if ( '/' == substr($info['name'], -1) ) // directory |
| 564 | 567 | $needed_dirs[] = $to . untrailingslashit($info['name']); |
| 565 | 568 | else |
| … |
… |
function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) { |
| 583 | 586 | if ( '/' == substr($info['name'], -1) ) // directory |
| 584 | 587 | continue; |
| 585 | 588 | |
| | 589 | if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files |
| | 590 | continue; |
| | 591 | |
| 586 | 592 | $contents = $z->getFromIndex($i); |
| 587 | 593 | if ( false === $contents ) |
| 588 | 594 | return new WP_Error('extract_failed', __('Could not extract file from archive.'), $info['name']); |
| … |
… |
function _unzip_file_pclzip($file, $to, $needed_dirs = array()) { |
| 622 | 628 | return new WP_Error('empty_archive', __('Empty archive.')); |
| 623 | 629 | |
| 624 | 630 | // Determine any children directories needed (From within the archive) |
| 625 | | foreach ( $archive_files as $file ) |
| | 631 | foreach ( $archive_files as $file ) { |
| | 632 | if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Skip the OS X-created __MACOSX directory |
| | 633 | continue; |
| | 634 | |
| 626 | 635 | $needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname($file['filename']) ); |
| | 636 | } |
| 627 | 637 | |
| 628 | 638 | $needed_dirs = array_unique($needed_dirs); |
| 629 | 639 | asort($needed_dirs); |
| … |
… |
function _unzip_file_pclzip($file, $to, $needed_dirs = array()) { |
| 640 | 650 | if ( $file['folder'] ) |
| 641 | 651 | continue; |
| 642 | 652 | |
| | 653 | if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files |
| | 654 | continue; |
| | 655 | |
| 643 | 656 | if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) ) |
| 644 | 657 | return new WP_Error('copy_failed', __('Could not copy file.'), $to . $file['filename']); |
| 645 | 658 | } |