WP_CLI\Utils

get_default_cacert()WP-CLI 1.0

Gets the full path to the default CA cert.

Хуков нет.

Возвращает

Строку. Absolute path to the default CA cert.

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

get_default_cacert( $halt_on_error );
$halt_on_error(true|false)
Whether or not command execution should be halted on error. Default: false
По умолчанию: false

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

function get_default_cacert( $halt_on_error = false ) {
	$cert_path = '/rmccue/requests/library/Requests/Transport/cacert.pem';
	$error_msg = 'Cannot find SSL certificate.';

	if ( inside_phar() ) {
		// cURL can't read Phar archives
		return extract_from_phar( WP_CLI_VENDOR_DIR . $cert_path );
	}

	foreach ( get_vendor_paths() as $vendor_path ) {
		if ( file_exists( $vendor_path . $cert_path ) ) {
			return $vendor_path . $cert_path;
		}
	}

	if ( $halt_on_error ) {
		WP_CLI::error( $error_msg );
	}

	throw new RuntimeException( $error_msg );
}