From 74332da34927305c03ec447d473a7d8448d5913f Mon Sep 17 00:00:00 2001 From: xaav Date: Mon, 27 Jun 2011 19:19:52 -0500 Subject: [PATCH] Using copy function. --- .../Downloader/AbstractDownloader.php | 37 ------------------- src/Composer/Downloader/PearDownloader.php | 4 +- 2 files changed, 2 insertions(+), 39 deletions(-) delete mode 100644 src/Composer/Downloader/AbstractDownloader.php diff --git a/src/Composer/Downloader/AbstractDownloader.php b/src/Composer/Downloader/AbstractDownloader.php deleted file mode 100644 index 3104be3f5..000000000 --- a/src/Composer/Downloader/AbstractDownloader.php +++ /dev/null @@ -1,37 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Downloader; - -use Composer\Package\PackageInterface; - -/** - * @author Jordi Boggiano - * @author Benjamin Eberlei - */ -abstract class AbstractDownloader -{ - protected function downloadFile($url, $path) - { - $file = fopen($url, "rb"); - if ($file) { - $newf = fopen($path, "wb"); - if ($newf) { - while (!feof($file)) { - fwrite($newf, fread($file, 1024 * 8), 1024 * 8); - } - fclose($newf); - } - fclose($file); - } - } -} \ No newline at end of file diff --git a/src/Composer/Downloader/PearDownloader.php b/src/Composer/Downloader/PearDownloader.php index 1cce75632..8f3645e6a 100644 --- a/src/Composer/Downloader/PearDownloader.php +++ b/src/Composer/Downloader/PearDownloader.php @@ -32,13 +32,13 @@ class PearDownloader extends AbstractDownloader } $tmpName = tempnam(sys_get_temp_dir(), ''); - $this->downloadFile($package->getSourceUrl(), $tmpName); + copy($package->getSourceUrl(), $tmpName); if (!file_exists($tmpName)) { throw new \UnexpectedValueException($package->getName().' could not be saved into '.$tmpName.', make sure the' .' directory is writable and you have internet connectivity.'); } - + $cwd = getcwd(); chdir($path); system('tar xzf '.escapeshellarg($tmpName));