]> granicus.if.org Git - php/commitdiff
* add "pedantic" mode in infoFromTgzFile and skip some checks if not
authorStig Bakken <ssb@php.net>
Sat, 22 Dec 2001 04:42:12 +0000 (04:42 +0000)
committerStig Bakken <ssb@php.net>
Sat, 22 Dec 2001 04:42:12 +0000 (04:42 +0000)
  pedantic

pear/PEAR/Common.php

index a717acd60792dbefb296c6bbe39e49b07db98f31..e25fcc3511fda935f68465861052fe6c82db81a3 100644 (file)
@@ -388,14 +388,17 @@ class PEAR_Common extends PEAR
     * Returns info from a tgz pear package
     * (experimental)
     */
-    function infoFromTgzFile($file)
+    function infoFromTgzFile($file, $pedantic = true)
     {
-        $file = basename($file); // XXX Fixme: Only allows file in the current dir
+        if ($pedantic) {
+            // XXX Fixme: Only allows file in the current dir
+            $file = basename($file);
+        }
         if (!@is_file($file)) {
             return $this->raiseError('no tar file supplied');
         }
         // Assume the decompressed dir name
-        if (($pos = strrpos($file, '.')) === false) {
+        if ($pedantic && ($pos = strrpos($file, '.')) === false) {
             return $this->raiseError('file doesn\'t follow the package name convention');
         }
         $pkgdir = substr($file, 0, $pos);