if ( str_starts_with( $info['name'
], '__MACOSX/'
) ) { // Don't extract the OS X-created __MACOSX directory files.
continue;
} // Don't extract invalid files:
if ( 0 !==
validate_file( $info['name'
] ) ) { continue;
} $contents =
$z->
getFromIndex( $i );
if ( false ===
$contents ) { return new WP_Error( 'extract_failed_ziparchive',
__( 'Could not extract file from archive.'
),
$info['name'
] );
} if ( !
$wp_filesystem->
put_contents( $to .
$info['name'
],
$contents, FS_CHMOD_FILE
) ) { return new WP_Error( 'copy_failed_ziparchive',
__( 'Could not copy file.'
),
$info['name'
] );
} } $z->
close();