diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-11-12 12:32:26 -0800 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-11-12 12:32:26 -0800 |
commit | c30996acd31ecb720fb9f22c5e5ab91099135477 (patch) | |
tree | 8a4a5b8b95eb32766d03eeaa06360970674ff461 /lib/plugins/plugin | |
parent | 649ee76f050057709402fd3d70243ea537d72b27 (diff) | |
parent | 35349ab097171f0f9cb6114cffd780abb69c56a6 (diff) | |
download | rpg-c30996acd31ecb720fb9f22c5e5ab91099135477.tar.gz rpg-c30996acd31ecb720fb9f22c5e5ab91099135477.tar.bz2 |
Merge pull request #140 from splitbrain/tar
New Tar Archive library
Diffstat (limited to 'lib/plugins/plugin')
-rw-r--r-- | lib/plugins/plugin/classes/ap_download.class.php | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/plugins/plugin/classes/ap_download.class.php b/lib/plugins/plugin/classes/ap_download.class.php index d1b518d9d..0eb567c80 100644 --- a/lib/plugins/plugin/classes/ap_download.class.php +++ b/lib/plugins/plugin/classes/ap_download.class.php @@ -200,31 +200,26 @@ class ap_download extends ap_manage { if (in_array($ext, array('tar','bz','gz'))) { switch($ext){ case 'bz': - $compress_type = TarLib::COMPRESS_BZIP; + $compress_type = Tar::COMPRESS_BZIP; break; case 'gz': - $compress_type = TarLib::COMPRESS_GZIP; + $compress_type = Tar::COMPRESS_GZIP; break; default: - $compress_type = TarLib::COMPRESS_NONE; + $compress_type = Tar::COMPRESS_NONE; } - $tar = new TarLib($file, $compress_type); - if($tar->_initerror < 0){ + $tar = new Tar(); + try { + $tar->open($file, $compress_type); + $tar->extract($target); + return true; + }catch(Exception $e){ if($conf['allowdebug']){ - msg('TarLib Error: '.$tar->TarErrorStr($tar->_initerror),-1); + msg('Tar Error: '.$e->getMessage().' ['.$e->getFile().':'.$e->getLine().']',-1); } return false; } - $ok = $tar->Extract(TarLib::FULL_ARCHIVE, $target, '', 0777); - - if($ok<1){ - if($conf['allowdebug']){ - msg('TarLib Error: '.$tar->TarErrorStr($ok),-1); - } - return false; - } - return true; } else if ($ext == 'zip') { $zip = new ZipLib(); |