summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas V.V.Cox <cox@php.net>2001-10-08 16:52:33 +0000
committerTomas V.V.Cox <cox@php.net>2001-10-08 16:52:33 +0000
commit13682462c764f5ff10e9515c96e76f5b345ecfae (patch)
tree86466936e665962a584a5457d699d580a19d4950
parent012840d145b470a02dda44d141a936675693629a (diff)
downloadphp-git-13682462c764f5ff10e9515c96e76f5b345ecfae.tar.gz
some clean up
-rw-r--r--pear/PEAR/Installer.php4
-rw-r--r--pear/PEAR/Packager.php22
2 files changed, 8 insertions, 18 deletions
diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php
index 92ebd5323e..f2ec95f729 100644
--- a/pear/PEAR/Installer.php
+++ b/pear/PEAR/Installer.php
@@ -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();
}
diff --git a/pear/PEAR/Packager.php b/pear/PEAR/Packager.php
index 61e042087b..16dcd9a0f5 100644
--- a/pear/PEAR/Packager.php
+++ b/pear/PEAR/Packager.php
@@ -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) {