Skip to content

Commit

Permalink
Merge pull request #83 from wp-cli/82-extract-certificate-from-phar
Browse files Browse the repository at this point in the history
Extract SSL certificate from Phar first before using it in Composer
  • Loading branch information
schlessera authored May 28, 2018
2 parents c912f5b + 1192f36 commit a7ce916
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 a7ce916

Please sign in to comment.