]> granicus.if.org Git - php/commitdiff
some clean up
authorTomas V.V.Cox <cox@php.net>
Mon, 8 Oct 2001 16:52:33 +0000 (16:52 +0000)
committerTomas V.V.Cox <cox@php.net>
Mon, 8 Oct 2001 16:52:33 +0000 (16:52 +0000)
pear/PEAR/Installer.php
pear/PEAR/Packager.php

index 92ebd5323e5aa436498e357d474f397303bbd96b..f2ec95f72954e9d31fe3223973bea3c639da3ee2 100644 (file)
@@ -81,10 +81,6 @@ class PEAR_Installer extends PEAR_Common
     function _PEAR_Installer()
     {
         chdir($this->pwd);
-        if ($this->tmpdir && is_dir($this->tmpdir)) {
-            System::rm("-rf $this->tmpdir");
-        }
-        $this->tmpdir = null;
         $this->_PEAR_Common();
     }
 
index 61e042087bcc44fd23a54196332dc20aeb223cee..16dcd9a0f54b8245321a67144bc2ed1e5b7c32f1 100644 (file)
@@ -86,17 +86,9 @@ class PEAR_Packager extends PEAR_Common
     // }}}
     // {{{ destructor
 
-    function _PEAR_Packager() {
-        $this->_PEAR();
-        while (is_array($this->_tempfiles) &&
-               $file = array_shift($this->_tempfiles))
-        {
-            if (is_dir($file)) {
-                System::rm("-rf $file");
-            } else {
-                unlink($file);
-            }
-        }
+    function _PEAR_Packager()
+    {
+        $this->_PEAR_Common();
     }
 
     // }}}
@@ -121,9 +113,11 @@ class PEAR_Packager extends PEAR_Common
         }
         $pwd = getcwd();
         $pkgfile = basename($pkgfile);
-        $pkgver = $pkginfo['package'] . '-' . $pkginfo['version'];
         // don't want strange characters
-        $pkgver = ereg_replace ('[^a-zA-Z0-9._]', '_', $pkgver);
+        $pkgname    = ereg_replace ('[^a-zA-Z0-9._]', '_', $pkginfo['package']);
+        $pkgversion = ereg_replace ('[^a-zA-Z0-9._\-]', '_', $pkginfo['version']);
+        $pkgver = $pkgname . '-' . $pkgversion;
+
         $this->tmpdir = $pwd . DIRECTORY_SEPARATOR . $pkgver;
         if (file_exists($this->tmpdir)) {
             return $this->raiseError('Tmpdir: ' . $this->tmpdir .' already exists',
@@ -135,7 +129,7 @@ class PEAR_Packager extends PEAR_Common
         } else {
             $this->log(2, "+ tmp dir created at: " . $this->tmpdir);
         }
-        $this->_tempfiles[] = $this->tmpdir;
+        $this->addTempFile($this->tmpdir);
 
         // Copy files -----------------------------------------------
         foreach ($pkginfo['filelist'] as $fname => $atts) {