瀏覽代碼

Expand cli TLS options to other commands + misc fixes

Pádraic Brady 11 年之前
父節點
當前提交
d8cbd9f057

+ 2 - 0
src/Composer/Command/CreateProjectCommand.php

@@ -69,6 +69,8 @@ class CreateProjectCommand extends Command
                 new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
                 new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deletion vcs folder.'),
                 new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
+                new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'),
+                new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'),
             ))
             ->setHelp(<<<EOT
 The <info>create-project</info> command creates a new project from a given

+ 1 - 3
src/Composer/Command/DiagnoseCommand.php

@@ -152,10 +152,8 @@ EOT
         }
 
         $rfsOptions = array();
-        if ($disableTls) {
-            if (!is_null($config->get('cafile'))) {
+        if (!$disableTls && !is_null($config->get('cafile'))) {
                 $rfsOptions = array('ssl'=>array('cafile'=>$config->get('cafile')));
-            }
         }
         try {
             $this->rfs = new RemoteFilesystem($this->getIO(), $rfsOptions, $disableTls);

+ 2 - 0
src/Composer/Command/InstallCommand.php

@@ -45,6 +45,8 @@ class InstallCommand extends Command
                 new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
                 new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
                 new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
+                new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'),
+                new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'),
                 new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
             ))
             ->setHelp(<<<EOT

+ 2 - 0
src/Composer/Command/SearchCommand.php

@@ -41,6 +41,8 @@ class SearchCommand extends Command
             ->setDescription('Search for packages')
             ->setDefinition(array(
                 new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
+                new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'),
+                new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'),
                 new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
             ))
             ->setHelp(<<<EOT

+ 1 - 1
src/Composer/Command/SelfUpdateCommand.php

@@ -77,7 +77,7 @@ EOT
         $remoteFilesystemOptions = array();
         if ($disableTls === false) {
             if (!is_null($config->get('cafile'))) {
-            $remoteFilesystemOptions = array('ssl'=>array('cafile'=>$config->get('cafile')));
+                $remoteFilesystemOptions = array('ssl'=>array('cafile'=>$config->get('cafile')));
             }
             if (!is_null($input->getOption('cafile'))) {
                 $remoteFilesystemOptions = array('ssl'=>array('cafile'=>$input->getOption('cafile')));

+ 2 - 0
src/Composer/Command/ShowCommand.php

@@ -50,6 +50,8 @@ class ShowCommand extends Command
                 new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
                 new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
                 new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
+                new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'),
+                new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'),
             ))
             ->setHelp(<<<EOT
 The show command displays detailed information about a package, or

+ 3 - 1
src/Composer/Command/UpdateCommand.php

@@ -45,7 +45,9 @@ class UpdateCommand extends Command
                 new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
                 new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist.'),
                 new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
-                new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.')
+                new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
+                new InputOption('disable-tls', null, InputOption::VALUE_NONE, 'Disable SSL/TLS protection for HTTPS requests'),
+                new InputOption('cafile', null, InputOption::VALUE_REQUIRED, 'The path to a valid CA certificate file for SSL/TLS certificate verification'),
             ))
             ->setHelp(<<<EOT
 The <info>update</info> command reads the composer.json file from the

+ 1 - 3
src/Composer/Factory.php

@@ -207,10 +207,8 @@ class Factory
                 }
 
                 $rfsOptions = array();
-                if ($disableTls === false) {
-                    if (!is_null($input->getOption('cafile'))) {
+                if ($disableTls === false && !is_null($input->getOption('cafile'))) {
                         $rfsOptions = array('ssl'=>array('cafile'=>$input->getOption('cafile')));
-                    }
                 }
                 $rfs = new RemoteFilesystem($io, $rfsOptions, $disableTls);
             }