WP_CLI
Extractor::extract
Extract the archive file to a specific destination.
Method of the class: Extractor{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = Extractor::extract( $tarball_or_zip, $dest );
- $tarball_or_zip(required)
- .
- $dest(string) (required)
- .
Extractor::extract() Extractor::extract code WP-CLI 2.13.0-alpha
public static function extract( $tarball_or_zip, $dest ) {
if ( preg_match( '/\.zip$/', $tarball_or_zip ) ) {
return self::extract_zip( $tarball_or_zip, $dest );
}
if ( preg_match( '/\.tar\.gz$/', $tarball_or_zip ) ) {
return self::extract_tarball( $tarball_or_zip, $dest );
}
throw new Exception( "Extraction only supported for '.zip' and '.tar.gz' file types." );
}