WP_CLI\Utils

extract_from_phar()WP-CLI 1.0

Files that need to be read by external programs have to be extracted from the Phar archive.

Хуков нет.

Возвращает

null. Ничего (null).

Использование

extract_from_phar( $path );
$path (обязательный)
-

Код extract_from_phar() WP-CLI 2.8.0-alpha

function extract_from_phar( $path ) {
	if ( ! inside_phar() ) {
		return $path;
	}

	$fname = basename( $path );

	$tmp_path = get_temp_dir() . uniqid( 'wp-cli-extract-from-phar-', true ) . "-$fname";

	copy( $path, $tmp_path );

	register_shutdown_function(
		function() use ( $tmp_path ) {
			if ( file_exists( $tmp_path ) ) {
				unlink( $tmp_path );
			}
		}
	);

	return $tmp_path;
}