Changeset 13006
- Timestamp:
- 02/07/2010 05:02:24 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r13005 r13006 539 539 540 540 $z = new ZipArchive(); 541 if ( ! $z->open($file) )541 if ( true !== $z->open($file, ZIPARCHIVE::CHECKCONS) ) 542 542 return new WP_Error('incompatible_archive', __('Incompatible Archive.')); 543 543 544 544 for ( $i = 0; $i < $z->numFiles; $i++ ) { 545 545 if ( ! $info = $z->statIndex($i) ) 546 return new WP_Error('stat_fail ure', __('Could not retrieve file from archive.'));546 return new WP_Error('stat_failed', __('Could not retrieve file from archive.')); 547 547 548 548 if ( '/' == substr($info['name'], -1) ) // directory … … 564 564 for ( $i = 0; $i < $z->numFiles; $i++ ) { 565 565 if ( ! $info = $z->statIndex($i) ) 566 return new WP_Error('stat_fail ure', __('Could not retrieve file from archive.'));566 return new WP_Error('stat_failed', __('Could not retrieve file from archive.')); 567 567 568 568 if ( '/' == substr($info['name'], -1) ) // directory 569 569 continue; 570 570 571 if ( ! $wp_filesystem->put_contents( $to . $info['name'], $z->getFromIndex($i), FS_CHMOD_FILE) ) 571 $contents = $z->getFromIndex($i); 572 if ( false === $contents ) 573 return new WP_Error('extract_failed', __('Could not extract file from archive.'), $info['name']); 574 575 if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) ) 572 576 return new WP_Error('copy_failed', __('Could not copy file.'), $to . $file['filename']); 573 577 }
Note: See TracChangeset
for help on using the changeset viewer.