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

Extract SSL certificate from Phar first before using it in Composer #83

Merged
merged 1 commit into from
May 28, 2018
Merged
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
4 changes: 3 additions & 1 deletion src/Package_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
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';

private $pool = false;

Expand Down Expand Up @@ -1072,7 +1073,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' ) ) {
putenv( 'SSL_CERT_FILE=phar://wp-cli.phar/vendor/rmccue/requests/library/Requests/Transport/cacert.pem' );
$certificate = Utils\extract_from_phar( WP_CLI_VENDOR_DIR . self::SSL_CERTIFICATE );
putenv( "SSL_CERT_FILE={$certificate}" );
}
}

Expand Down