cvs: php4 /pear/PEAR Installer.php
| From: | Thomas V.V.Cox | Date: | Mon, 08 Oct 2001 06:12:14 +0000 |
| Subject: | cvs: php4 /pear/PEAR Installer.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-956@lists.php.net to get a copy of this message | ||
cox Mon Oct 8 02:12:14 2001 EDT
Modified files:
/php4/pear/PEAR Installer.php
Log:
more work on Windows support
Index: php4/pear/PEAR/Installer.php
diff -u php4/pear/PEAR/Installer.php:1.19 php4/pear/PEAR/Installer.php:1.20
--- php4/pear/PEAR/Installer.php:1.19 Sun Oct 7 16:16:41 2001
+++ php4/pear/PEAR/Installer.php Mon Oct 8 02:12:13 2001
@@ -18,7 +18,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Installer.php,v 1.19 2001/10/07 20:16:41 cox Exp $
+// $Id: Installer.php,v 1.20 2001/10/08 06:12:13 cox Exp $
require_once 'PEAR/Common.php';
@@ -110,15 +110,15 @@
} elseif (!@is_file($pkgfile)) {
return $this->raiseError("Could not open the package file: $pkgfile");
}
+
// Download package -----------------------------------------------
if ($need_download) {
$file = basename($pkgfile);
- // XXX FIXME use ??? on Windows, use $TMPDIR on unix (use tmpnames?)
- $downloaddir = '/tmp/pearinstall';
- if (!$this->mkDirHier($downloaddir)) {
- return $this->raiseError("Failed to create tmp dir: $downloaddir");
+ if (PEAR::isError($downloaddir = $this->mkTempDir())) {
+ return $downloaddir;
}
- $downloadfile = $downloaddir.DIRECTORY_SEPARATOR.$file;
+ $this->log(2, '+ tmp dir created at ' . $downloaddir);
+ $downloadfile = $downloaddir . DIRECTORY_SEPARATOR . $file;
$this->log(1, "downloading $pkgfile ...");
if (!$fp = @fopen($pkgfile, 'r')) {
return $this->raiseError("$pkgfile: failed to download
($php_errormsg)");
@@ -126,7 +126,6 @@
if (!$wp = @fopen($downloadfile, 'w')) {
return $this->raiseError("$downloadfile: write failed
($php_errormsg)");
}
- $this->addTempFile($downloadfile);
$bytes = 0;
while ($data = @fread($fp, 16384)) {
$bytes += strlen($data);
@@ -148,18 +147,13 @@
}
$pkgfile = getcwd() . DIRECTORY_SEPARATOR . basename($pkgfile);
- // XXX FIXME Windows
- $this->tmpdir = tempnam('/tmp', 'pear');
- unlink($this->tmpdir);
- if (!mkdir($this->tmpdir, 0755)) {
- return $this->raiseError("Unable to create temporary directory
$this->tmpdir.");
- } else {
- $this->log(2, '+ tmp dir created at ' . $this->tmpdir);
+ if (PEAR::isError($tmpdir = $this->mkTempDir())) {
+ return $tmpdir;
}
- $this->addTempFile($this->tmpdir);
+ $this->log(2, '+ tmp dir created at ' . $tmpdir);
$tar = new Archive_Tar($pkgfile, true);
- if (!$tar->extract($this->tmpdir)) {
+ if (!$tar->extract($tmpdir)) {
return $this->raiseError("Unable to unpack $pkgfile");
}
$file = basename($pkgfile);
@@ -168,7 +162,7 @@
return $this->raiseError('package doesn\'t follow the package name
convention');
}
$pkgdir = substr($file, 0, $pos);
- $descfile = $this->tmpdir . DIRECTORY_SEPARATOR . $pkgdir . DIRECTORY_SEPARATOR .
'package.xml';
+ $descfile = $tmpdir . DIRECTORY_SEPARATOR . $pkgdir . DIRECTORY_SEPARATOR .
'package.xml';
if (!is_file($descfile)) {
return $this->raiseError("No package.xml file after extracting the
archive.");