cvs: pear-core / package-PEAR.xml /PEAR Installer.php
| From: | Greg Beaver | Date: | Sun, 07 Jan 2007 16:14:16 +0000 |
| Subject: | cvs: pear-core / package-PEAR.xml /PEAR Installer.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-5335@lists.php.net to get a copy of this message | ||
cellog Sun Jan 7 16:14:16 2007 UTC
Modified files:
/pear-core package-PEAR.xml
/pear-core/PEAR Installer.php
Log:
* fix Bug #9712: pear uninstall --register-only remove file : it should not
http://cvs.php.net/viewvc.cgi/pear-core/package-PEAR.xml?r1=1.412&r2=1.413&diff_format=u
Index: pear-core/package-PEAR.xml
diff -u pear-core/package-PEAR.xml:1.412 pear-core/package-PEAR.xml:1.413
--- pear-core/package-PEAR.xml:1.412 Sun Jan 7 16:11:25 2007
+++ pear-core/package-PEAR.xml Sun Jan 7 16:14:15 2007
@@ -85,6 +85,7 @@
<notes>
* fix Bug #9660: dependency sorting on installation does not always work
* fix Bug #9688: [PATCH] Fix build of PECL extensions
+ * fix Bug #9712: pear uninstall --register-only remove file : it should not
</notes>
<provides type="class" name="OS_Guess"/>
<provides type="class" name="System"/>
http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Installer.php?r1=1.239&r2=1.240&diff_format=u
Index: pear-core/PEAR/Installer.php
diff -u pear-core/PEAR/Installer.php:1.239 pear-core/PEAR/Installer.php:1.240
--- pear-core/PEAR/Installer.php:1.239 Wed Dec 20 19:34:03 2006
+++ pear-core/PEAR/Installer.php Sun Jan 7 16:14:15 2007
@@ -18,7 +18,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Installer.php,v 1.239 2006/12/20 19:34:03 cellog Exp $
+ * @version CVS: $Id: Installer.php,v 1.240 2007/01/07 16:14:15 cellog Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*/
@@ -1459,6 +1459,7 @@
* @param array Command-line options. Possibilities include:
*
* - installroot: base installation dir, if not the default
+ * - register-only : update registry but don't remove files
* - nodeps: do not process dependencies of other packages to ensure
* uninstallation does not break things
*/
@@ -1524,41 +1525,24 @@
}
}
$this->pkginfo = &$pkg;
- // {{{ Delete the files
- $this->startFileTransaction();
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- if (PEAR::isError($err = $this->_deletePackageFiles($package, $channel))) {
- PEAR::popErrorHandling();
- $this->rollbackFileTransaction();
- $this->configSet('default_channel', $savechannel);
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError($err);
- } else {
- if (!isset($options['soft'])) {
- $this->log(0, 'WARNING: ' . $err->getMessage());
- }
- }
- } else {
- PEAR::popErrorHandling();
- }
- if (!$this->commitFileTransaction()) {
- $this->rollbackFileTransaction();
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError("uninstall failed");
- } elseif (!isset($options['soft'])) {
- $this->log(0, 'WARNING: uninstall failed');
- }
- } else {
+ // pretty much nothing happens if we are only registering the uninstall
+ if (empty($options['register-only'])) {
+ // {{{ Delete the files
$this->startFileTransaction();
- if ($dirtree = $pkg->getDirTree()) {
- // attempt to delete empty directories
- uksort($dirtree, array($this, '_sortDirs'));
- foreach($dirtree as $dir => $notused) {
- $this->addFileOperation('rmdir', array($dir));
+ PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
+ if (PEAR::isError($err = $this->_deletePackageFiles($package, $channel))) {
+ PEAR::popErrorHandling();
+ $this->rollbackFileTransaction();
+ $this->configSet('default_channel', $savechannel);
+ if (!isset($options['ignore-errors'])) {
+ return $this->raiseError($err);
+ } else {
+ if (!isset($options['soft'])) {
+ $this->log(0, 'WARNING: ' . $err->getMessage());
+ }
}
} else {
- $this->configSet('default_channel', $savechannel);
- return $this->_registry->deletePackage($package, $channel);
+ PEAR::popErrorHandling();
}
if (!$this->commitFileTransaction()) {
$this->rollbackFileTransaction();
@@ -1567,9 +1551,29 @@
} elseif (!isset($options['soft'])) {
$this->log(0, 'WARNING: uninstall failed');
}
+ } else {
+ $this->startFileTransaction();
+ if ($dirtree = $pkg->getDirTree()) {
+ // attempt to delete empty directories
+ uksort($dirtree, array($this, '_sortDirs'));
+ foreach($dirtree as $dir => $notused) {
+ $this->addFileOperation('rmdir', array($dir));
+ }
+ } else {
+ $this->configSet('default_channel', $savechannel);
+ return $this->_registry->deletePackage($package, $channel);
+ }
+ if (!$this->commitFileTransaction()) {
+ $this->rollbackFileTransaction();
+ if (!isset($options['ignore-errors'])) {
+ return $this->raiseError("uninstall failed");
+ } elseif (!isset($options['soft'])) {
+ $this->log(0, 'WARNING: uninstall failed');
+ }
+ }
}
+ // }}}
}
- // }}}
$this->configSet('default_channel', $savechannel);
// Register that the package is no longer installed