WP_CLI

Extractor::extract()public staticWP-CLI 1.0

Extract the archive file to a specific destination.

Method of the class: Extractor{}

No Hooks.

Return

null. Nothing.

Usage

$result = Extractor::extract( $tarball_or_zip, $dest );
$tarball_or_zip (required)
-
$dest(string) (required)
-

Extractor::extract() code WP-CLI 2.8.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." );
}