$z =
new ZipArchive();
$zopen =
$z->
open( $file, ZIPARCHIVE::CHECKCONS
);
if ( true !==
$zopen ) { return new WP_Error( 'incompatible_archive',
__( 'Incompatible Archive.'
), array
( 'ziparchive_error' =>
$zopen ) );
} $uncompressed_size = 0;
for ( $i = 0;
$i <
$z->numFiles;
$i++
) { $info =
$z->
statIndex( $i );
if ( !
$info ) { return new WP_Error( 'stat_failed_ziparchive',
__( 'Could not retrieve file from archive.'
) );
} if ( str_starts_with( $info['name'
], '__MACOSX/'
) ) { // Skip the OS X-created __MACOSX directory.
continue;
} // Don't extract invalid files:
if ( 0 !==
validate_file( $info['name'
] ) ) {