]> granicus.if.org Git - php/commitdiff
extract only the package.xml file instead of all files
authorTomas V.V.Cox <cox@php.net>
Sat, 29 Sep 2001 00:38:24 +0000 (00:38 +0000)
committerTomas V.V.Cox <cox@php.net>
Sat, 29 Sep 2001 00:38:24 +0000 (00:38 +0000)
pear/PEAR/Common.php

index 5680f55acf06c35491e5267d16ce205bccfbe8a6..24fb4dfadfb59661f3b23ad274e146dd40f6aaad 100644 (file)
@@ -377,27 +377,17 @@ class PEAR_Common extends PEAR
         if (!@is_file($file)) {
             return $this->raiseError('no tar file supplied');
         }
-        $tar = new Archive_Tar($file, true);
-        // XXX Fixme Windows
-        $tmpdir = '/tmp' . DIRECTORY_SEPARATOR . $file;
-        if (file_exists($tmpdir)) {
-            return $this->raiseError('Tmpdir: ' . $tmpdir .' already exists',
-                              null, PEAR_ERROR_TRIGGER, E_USER_ERROR);
-        }
-        if (!mkdir($tmpdir, 0755)) {
-            return $this->raiseError("Unable to create temporary directory $tmpdir.",
-                              null, PEAR_ERROR_TRIGGER, E_USER_ERROR);
-        }
-        $tar->extract($tmpdir);
         // Assume the decompressed dir name
         if (($pos = strrpos($file, '.')) === false) {
             return $this->raiseError('file doesn\'t follow the package name convention');
         }
         $pkgdir = substr($file, 0, $pos);
+        $xml = $pkgdir . DIRECTORY_SEPARATOR . 'package.xml';
 
-        $xml = $tmpdir . DIRECTORY_SEPARATOR . $pkgdir . DIRECTORY_SEPARATOR .'package.xml';
+        $tar = new Archive_Tar($file, true);
+        $tar->extractList($xml);
         $info = $this->infoFromDescriptionFile($xml);
-        system("rm -rf $tmpdir"); // XXX FIXME Windows
+        unlink($xml);
         return $info;
     }
 }