Skip to content

Commit

Permalink
Extract SSL certificate from Phar first before using it in Composer
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed May 28, 2018
1 parent bc49fbc commit 3b896fa
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 3b896fa

Please sign in to comment.