cvs: php4 /pear/PEAR Installer.php
| From: | Stig Bakken | Date: | Tue, 11 Dec 2001 08:39:02 +0000 |
| Subject: | cvs: php4 /pear/PEAR Installer.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1506@lists.php.net to get a copy of this message | ||
ssb Tue Dec 11 03:39:02 2001 EDT
Modified files:
/php4/pear/PEAR Installer.php
Log:
* added "register_only" option for install/uninstall
Index: php4/pear/PEAR/Installer.php
diff -u php4/pear/PEAR/Installer.php:1.28 php4/pear/PEAR/Installer.php:1.29
--- php4/pear/PEAR/Installer.php:1.28 Mon Dec 10 12:00:32 2001
+++ php4/pear/PEAR/Installer.php Tue Dec 11 03:39:01 2001
@@ -18,7 +18,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Installer.php,v 1.28 2001/12/10 17:00:32 ssb Exp $
+// $Id: Installer.php,v 1.29 2001/12/11 08:39:01 ssb Exp $
require_once 'PEAR/Common.php';
require_once 'PEAR/Registry.php';
@@ -129,7 +129,7 @@
* @return bool true if successful, false if not
*/
- function install($pkgfile)
+ function install($pkgfile, $options = array())
{
// XXX FIXME Add here code to manage packages database
//$this->loadPackageList("$this->statedir/packages.lst");
@@ -217,23 +217,27 @@
}
// Copy files to dest dir ---------------------------------------
- if (!is_dir($this->phpdir)) {
- chdir($oldcwd);
- return $this->raiseError("no script destination directory found",
- null, PEAR_ERROR_DIE);
- }
- $tmp_path = dirname($descfile);
- foreach ($pkginfo['filelist'] as $fname => $atts) {
- $dest_dir = $this->phpdir . DIRECTORY_SEPARATOR;
- if (isset($atts['baseinstalldir'])) {
- $dest_dir .= $atts['baseinstalldir'] . DIRECTORY_SEPARATOR;
- }
- if (dirname($fname) != '.') {
- $dest_dir .= dirname($fname) . DIRECTORY_SEPARATOR;
+ if (empty($options['register_only'])) {
+ if (!is_dir($this->phpdir)) {
+ chdir($oldcwd);
+ return $this->raiseError("no script destination directory\n",
+ null, PEAR_ERROR_DIE);
+ }
+ $tmp_path = dirname($descfile);
+ foreach ($pkginfo['filelist'] as $fname => $atts) {
+ $dest_dir = $this->phpdir . DIRECTORY_SEPARATOR;
+ if (isset($atts['baseinstalldir'])) {
+ $dest_dir .= $atts['baseinstalldir'] . DIRECTORY_SEPARATOR;
+ }
+ if (dirname($fname) != '.') {
+ $dest_dir .= dirname($fname) . DIRECTORY_SEPARATOR;
+ }
+ $fname = $tmp_path . DIRECTORY_SEPARATOR . $fname;
+ $this->_installFile($fname, $dest_dir, $atts);
}
- $fname = $tmp_path . DIRECTORY_SEPARATOR . $fname;
- $this->_installFile($fname, $dest_dir, $atts);
- }
+ }
+
+ // Register that the package is installed -----------------------
$this->registry->addPackage($pkginfo['package'], $pkginfo);
chdir($oldcwd);
return true;
@@ -251,16 +255,19 @@
return $this->raiseError("is not installed");
}
$info = $this->registry->packageInfo($package);
- foreach ($info['filelist'] as $file => $props) {
- $base = (isset($props['baseinstalldir'])) ?
$props['baseinstalldir'] : '';
- $path = PEAR_INSTALL_DIR . DIRECTORY_SEPARATOR . $base .
- DIRECTORY_SEPARATOR . $file;
- if (!@unlink($path)) {
- $this->log(2, "unable to delete: $path");
- } else {
- $this->log(2, "+ deleted file: $path");
+ if (empty($options['register_only'])) {
+ foreach ($info['filelist'] as $file => $props) {
+ $base = (isset($props['baseinstalldir'])) ?
$props['baseinstalldir'] : '';
+ $path = PEAR_INSTALL_DIR . DIRECTORY_SEPARATOR . $base .
+ DIRECTORY_SEPARATOR . $file;
+ if (!@unlink($path)) {
+ $this->log(2, "unable to delete: $path");
+ } else {
+ $this->log(2, "+ deleted file: $path");
+ }
}
}
+ // Register that the package is no longer installed -------------
$this->registry->deletePackage($package);
return true;
}