OSDN Git Service

make cacert.pem file available from Phar; closes #859
authorscribu <mail@scribu.net>
Thu, 7 Nov 2013 16:10:51 +0000 (18:10 +0200)
committerscribu <mail@scribu.net>
Thu, 7 Nov 2013 16:10:51 +0000 (18:10 +0200)
php/commands/core.php
utils/make-phar.php

index 2a11de3..e0f2d78 100644 (file)
@@ -13,7 +13,7 @@ class Core_Command extends WP_CLI_Command {
         * Download core WordPress files.
         *
         * ## OPTIONS
-        * 
+        *
         * [--path=<path>]
         * : Specify the path in which to install WordPress.
         *
@@ -125,6 +125,16 @@ class Core_Command extends WP_CLI_Command {
        }
 
        private static function _request( $method, $url, $headers = array(), $options = array() ) {
+               // cURL can't read Phar archives
+               if ( 0 === strpos( WP_CLI_ROOT, 'phar://' ) ) {
+                       $options['verify'] = sys_get_temp_dir() . '/wp-cli-cacert.pem';
+
+                       copy(
+                               WP_CLI_ROOT . '/vendor/rmccue/requests/library/Requests/Transport/cacert.pem',
+                               $options['verify']
+                       );
+               }
+
                try {
                        return Requests::get( $url, $headers, $options );
                } catch( Requests_Exception $ex ) {
index 0a7b16d..4563f60 100644 (file)
@@ -62,6 +62,7 @@ foreach ( $finder as $file ) {
 }
 
 add_file( $phar, './vendor/autoload.php' );
+add_file( $phar, './vendor/rmccue/requests/library/Requests/Transport/cacert.pem' );
 
 $phar->setStub( <<<EOB
 #!/usr/bin/env php