diff --git a/src/Composer/Downloader/PearDownloader.php b/src/Composer/Downloader/PearDownloader.php index 2bb1f9c72..07ffc1a09 100644 --- a/src/Composer/Downloader/PearDownloader.php +++ b/src/Composer/Downloader/PearDownloader.php @@ -15,13 +15,19 @@ namespace Composer\Downloader; use Composer\Package\PackageInterface; /** + * Downloader for pear packages + * * @author Jordi Boggiano + * @author Kirill chEbba Chebunin */ -class PearDownloader extends FileDownloader +class PearDownloader extends TarDownloader { + /** + * {@inheritDoc} + */ protected function extract($file, $path) { - system(sprintf('tar -zxf %s', escapeshellarg($file))); + parent::extract($file, $path); @unlink($path . '/package.sig'); @unlink($path . '/package.xml'); } diff --git a/src/Composer/Downloader/PharDownloader.php b/src/Composer/Downloader/PharDownloader.php new file mode 100644 index 000000000..290b0281e --- /dev/null +++ b/src/Composer/Downloader/PharDownloader.php @@ -0,0 +1,33 @@ + + * 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; + +/** + * Downloader for phar files + * + * @author Kirill chEbba Chebunin + */ +class PharDownloader extends FileDownloader +{ + /** + * {@inheritDoc} + */ + protected function extract($file, $path) + { + // Can throw an UnexpectedValueException + $archive = new \Phar($file); + $archive->extractTo($path); + } +} diff --git a/src/Composer/Downloader/TarDownloader.php b/src/Composer/Downloader/TarDownloader.php new file mode 100644 index 000000000..c239475f7 --- /dev/null +++ b/src/Composer/Downloader/TarDownloader.php @@ -0,0 +1,33 @@ + + * 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; + +/** + * Downloader for tar files: tar, tar.gz or tar.bz2 + * + * @author Kirill chEbba Chebunin + */ +class TarDownloader extends FileDownloader +{ + /** + * {@inheritDoc} + */ + protected function extract($file, $path) + { + // Can throw an UnexpectedValueException + $archive = new \PharData($file); + $archive->extractTo($path); + } +}