Преглед изворни кода

Add warnings if OpenSSL is not enabled, fixes #84

Jordi Boggiano пре 13 година
родитељ
комит
0cfbea624e

+ 4 - 0
src/Composer/Downloader/FileDownloader.php

@@ -50,6 +50,10 @@ abstract class FileDownloader implements DownloaderInterface
 
         echo 'Downloading '.$url.' to '.$fileName.PHP_EOL;
 
+        if (0 === strpos($url, 'https:') && !extension_loaded('openssl')) {
+            throw new \RuntimeException('You must enable the openssl extension to download files via https');
+        }
+
         copy($url, $fileName);
 
         if (!file_exists($fileName)) {

+ 4 - 0
src/Composer/Downloader/GitDownloader.php

@@ -36,6 +36,10 @@ class GitDownloader implements DownloaderInterface
             throw new \InvalidArgumentException('The given package is missing reference information');
         }
 
+        if (!extension_loaded('openssl')) {
+            throw new \RuntimeException('You must enable the openssl extension to clone git repositories');
+        }
+
         $url = escapeshellarg($package->getSourceUrl());
         $ref = escapeshellarg($package->getSourceReference());
         system(sprintf('git clone %s %s && cd %2$s && git reset --hard %s', $url, $path, $ref));