From ab2d33f1ead209434a63d0c26709a82358d055ab Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Fri, 12 May 2023 16:49:58 +0200 Subject: [PATCH] Adapt bundled certificate access --- composer.json | 2 +- src/Package_Command.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 7f912e05..23e78fb7 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "require": { "ext-json": "*", "composer/composer": "^1.10.23 || ~2.2.17", - "wp-cli/wp-cli": "^2.5" + "wp-cli/wp-cli": "dev-main as 2.8.x-dev" }, "require-dev": { "wp-cli/scaffold-command": "^1 || ^2", diff --git a/src/Package_Command.php b/src/Package_Command.php index abf029b2..e50d6662 100644 --- a/src/Package_Command.php +++ b/src/Package_Command.php @@ -26,6 +26,7 @@ use WP_CLI\Utils; use WP_CLI\JsonManipulator; use WP_CLI\PackageManagerEventSubscriber; +use WP_CLI\RequestsLibrary; /** * Lists, installs, and removes WP-CLI packages. @@ -78,7 +79,6 @@ class Package_Command extends WP_CLI_Command { const PACKAGE_INDEX_URL = 'https://wp-cli.org/package-index/'; - const SSL_CERTIFICATE = '/rmccue/requests/library/Requests/Transport/cacert.pem'; const DEFAULT_DEV_BRANCH_CONSTRAINTS = 'dev-main || dev-master || dev-trunk'; @@ -1316,8 +1316,8 @@ private function set_composer_auth_env_var() { */ private function avoid_composer_ca_bundle() { if ( Utils\inside_phar() && ! getenv( 'SSL_CERT_FILE' ) && ! getenv( 'SSL_CERT_DIR' ) && ! ini_get( 'openssl.cafile' ) && ! ini_get( 'openssl.capath' ) ) { - $certificate = Utils\extract_from_phar( WP_CLI_VENDOR_DIR . self::SSL_CERTIFICATE ); - putenv( "SSL_CERT_FILE={$certificate}" ); + $certificate_path = Utils\extract_from_phar( RequestsLibrary::get_bundled_certificate_path() ); + putenv( "SSL_CERT_FILE={$certificate_path}" ); } }