summaryrefslogtreecommitdiff
path: root/lib/plugins/extension
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2015-05-16 11:47:11 +0200
committerAndreas Gohr <andi@splitbrain.org>2015-05-16 11:47:11 +0200
commit89167b55d9da5a67be5678038be7a474e5956dbd (patch)
treed41dcbca53dba23d71b300782805c5f5314e5cfa /lib/plugins/extension
parent38175ed45a1a1684e8da55d0f5cd825ee4804c3d (diff)
parent313d3e75d6e76a2d4336143256b8d0b8777e2849 (diff)
downloadrpg-89167b55d9da5a67be5678038be7a474e5956dbd.tar.gz
rpg-89167b55d9da5a67be5678038be7a474e5956dbd.tar.bz2
Merge pull request #1152 from splitbrain/composer
Use composer to add 3rd party libs
Diffstat (limited to 'lib/plugins/extension')
-rw-r--r--lib/plugins/extension/helper/extension.php27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php
index 6c0946b09..d089245b5 100644
--- a/lib/plugins/extension/helper/extension.php
+++ b/lib/plugins/extension/helper/extension.php
@@ -1035,33 +1035,24 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin {
$ext = $this->guess_archive($file);
if(in_array($ext, array('tar', 'bz', 'gz'))) {
- switch($ext) {
- case 'bz':
- $compress_type = Tar::COMPRESS_BZIP;
- break;
- case 'gz':
- $compress_type = Tar::COMPRESS_GZIP;
- break;
- default:
- $compress_type = Tar::COMPRESS_NONE;
- }
- $tar = new Tar();
try {
- $tar->open($file, $compress_type);
+ $tar = new \splitbrain\PHPArchive\Tar();
+ $tar->open($file);
$tar->extract($target);
- } catch (Exception $e) {
+ } catch (\splitbrain\PHPArchive\ArchiveIOException $e) {
throw new Exception($this->getLang('error_decompress').' '.$e->getMessage());
}
return true;
} elseif($ext == 'zip') {
- $zip = new ZipLib();
- $ok = $zip->Extract($file, $target);
-
- if($ok == -1){
- throw new Exception($this->getLang('error_decompress').' Error extracting the zip archive');
+ try {
+ $zip = new \splitbrain\PHPArchive\Zip();
+ $zip->open($file);
+ $zip->extract($target);
+ } catch (\splitbrain\PHPArchive\ArchiveIOException $e) {
+ throw new Exception($this->getLang('error_decompress').' '.$e->getMessage());
}
return true;