cvs: php4 /pear/PEAR Installer.php

From: Date: Tue, 13 Nov 2001 01:05:47 +0000
Subject: cvs: php4 /pear/PEAR Installer.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1310@lists.php.net to get a copy of this message
ssb Mon Nov 12 20:05:47 2001 EDT Modified files: /php4/pear/PEAR Installer.php Log: * error message cleanup * store registry object as property Index: php4/pear/PEAR/Installer.php diff -u php4/pear/PEAR/Installer.php:1.25 php4/pear/PEAR/Installer.php:1.26 --- php4/pear/PEAR/Installer.php:1.25 Wed Oct 31 00:39:11 2001 +++ php4/pear/PEAR/Installer.php Mon Nov 12 20:05:46 2001 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Installer.php,v 1.25 2001/10/31 05:39:11 ssb Exp $ +// $Id: Installer.php,v 1.26 2001/11/13 01:05:46 ssb Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Registry.php'; @@ -61,6 +61,9 @@ /** temporary directory */ var $tmpdir; + /** PEAR_Registry object used by the installer */ + var $registry; + // }}} // {{{ constructor @@ -91,13 +94,15 @@ { // XXX FIXME Add here code to manage packages database //$this->loadPackageList("$this->statedir/packages.lst"); - $registry = new PEAR_Registry; + if (empty($this->registry)) { + $this->registry = new PEAR_Registry; + } $oldcwd = getcwd(); $need_download = false; if (preg_match('#^(http|ftp)://#', $pkgfile)) { $need_download = true; } elseif (!@is_file($pkgfile)) { - return $this->raiseError("Could not open the package file: $pkgfile"); + return $this->raiseError("could not open the package file: $pkgfile"); } // Download package ----------------------------------------------- @@ -132,7 +137,7 @@ // To allow relative package file calls if (!chdir(dirname($pkgfile))) { - return $this->raiseError('Unable to chdir to pakage directory'); + return $this->raiseError('unable to chdir to package directory'); } $pkgfile = getcwd() . DIRECTORY_SEPARATOR . basename($pkgfile); @@ -145,20 +150,20 @@ $tar = new Archive_Tar($pkgfile, true); if (!$tar->extract($tmpdir)) { chdir($oldcwd); - return $this->raiseError("Unable to unpack $pkgfile"); + return $this->raiseError("unable to unpack $pkgfile"); } $file = basename($pkgfile); // Assume the decompressed dir name if (($pos = strrpos($file, '.')) === false) { chdir($oldcwd); - return $this->raiseError("package doesn't follow the package name convention"); + return $this->raiseError("invalid package name"); } $pkgdir = substr($file, 0, $pos); $descfile = $tmpdir . DIRECTORY_SEPARATOR . $pkgdir . DIRECTORY_SEPARATOR . 'package.xml'; if (!is_file($descfile)) { chdir($oldcwd); - return $this->raiseError("No package.xml file after extracting the archive."); + return $this->raiseError("no package.xml file after extracting the archive"); } // Parse xml file ----------------------------------------------- @@ -168,14 +173,14 @@ return $pkginfo; } - if ($registry->packageExists($pkginfo['package'])) { + if ($this->registry->packageExists($pkginfo['package'])) { return $this->raiseError("package already installed"); } // Copy files to dest dir --------------------------------------- if (!is_dir($this->phpdir)) { chdir($oldcwd); - return $this->raiseError("No script destination directory found\n", + return $this->raiseError("no script destination directory found", null, PEAR_ERROR_DIE); } $tmp_path = dirname($descfile); @@ -190,7 +195,7 @@ $fname = $tmp_path . DIRECTORY_SEPARATOR . $fname; $this->_installFile($fname, $dest_dir, $atts); } - $registry->addPackage($pkginfo['package'], $pkginfo); + $this->registry->addPackage($pkginfo['package'], $pkginfo); chdir($oldcwd); return true; }

« previous php.pear.cvs (#1310) next »