Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt bundled certificate access #174

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/Package_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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';

Expand Down Expand Up @@ -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}" );
}
}

Expand Down