diff options
author | Stig Bakken <ssb@php.net> | 2002-05-27 11:59:09 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 2002-05-27 11:59:09 +0000 |
commit | f3c5fea7a462c00780520a6a3e00dbd6aa19bfb9 (patch) | |
tree | b38a8fa4921eafbbab1fa1caf28d5c6230e0f3e8 /pear/Archive | |
parent | d351f618fc4a22ad6cfa41e68f74da5a958d421d (diff) | |
download | php-git-f3c5fea7a462c00780520a6a3e00dbd6aa19bfb9.tar.gz |
* make Archive_Tar auto-detect whether zlib is needed based on file
extension (.tar -> no zlib)
Diffstat (limited to 'pear/Archive')
-rw-r--r-- | pear/Archive/Tar.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pear/Archive/Tar.php b/pear/Archive/Tar.php index b577fef959..86bf0ee07a 100644 --- a/pear/Archive/Tar.php +++ b/pear/Archive/Tar.php @@ -61,15 +61,23 @@ class Archive_Tar extends PEAR * @param boolean $p_compress if true, the archive will be gezip(ped) * @access public */ - function Archive_Tar($p_tarname, $p_compress = false) + function Archive_Tar($p_tarname, $p_compress = null) { $this->PEAR(); + if ($p_compress === null) { + if (substr($p_tarname, -4) == '.tar') { + $p_compress = false; + } + } $this->_tarname = $p_tarname; if ($p_compress) { // assert zlib extension support $extname = 'zlib'; if (!extension_loaded($extname)) { - $dlext = (OS_WINDOWS) ? '.dll' : '.so'; - @dl($extname . $dlext); + if (OS_WINDOWS) { + @dl("php_$extname.dll"); + } else { + @dl("$extname.so"); + } } if (!extension_loaded($extname)) { die("The extension '$extname' couldn't be found.\n". |