cvs: pear-core /PEAR Installer.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Thu, 05 Mar 2009 00:32:13 +0000 |
| Subject: | cvs: pear-core /PEAR Installer.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-8228@lists.php.net to get a copy of this message | ||
dufuz Thu Mar 5 00:32:13 2009 UTC
Modified files:
/pear-core/PEAR Installer.php
Log:
Fix Bug #15979 Package files incorrectly removed when splitting a package into multiple pkgs
http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Installer.php?r1=1.257&r2=1.258&diff_format=u
Index: pear-core/PEAR/Installer.php
diff -u pear-core/PEAR/Installer.php:1.257 pear-core/PEAR/Installer.php:1.258
--- pear-core/PEAR/Installer.php:1.257 Tue Feb 24 23:38:22 2009
+++ pear-core/PEAR/Installer.php Thu Mar 5 00:32:13 2009
@@ -12,7 +12,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php
New BSD License
- * @version CVS: $Id: Installer.php,v 1.257 2009/02/24 23:38:22 dufuz Exp $
+ * @version CVS: $Id: Installer.php,v 1.258 2009/03/05 00:32:13 dufuz Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*/
@@ -794,7 +794,7 @@
}
// }}}
- $m = sizeof($errors);
+ $m = count($errors);
if ($m > 0) {
foreach ($errors as $error) {
if (!isset($this->_options['soft'])) {
@@ -806,6 +806,7 @@
return false;
}
}
+
$this->_dirtree = array();
// {{{ really commit the transaction
foreach ($this->file_operations as $i => $tr) {
@@ -813,6 +814,7 @@
// support removal of non-existing backups
continue;
}
+
list($type, $data) = $tr;
switch ($type) {
case 'backup':
@@ -1214,9 +1216,22 @@
foreach ($tmp as $file => $info) {
if (is_array($info)) {
if (strtolower($info[1]) == strtolower($param->getPackage())
&&
- strtolower($info[0]) == strtolower($param->getChannel())) {
+ strtolower($info[0]) == strtolower($param->getChannel())
+ ) {
+ if (isset($parentreg['filelist'][$file])) {
+ unset($parentreg['filelist'][$file]);
+ } else{
+ $pos = strpos($file, '/');
+ $basedir = substr($file, 0, $pos);
+ $file2 = substr($file, $pos + 1);
+ if
(isset($parentreg['filelist'][$file2]['baseinstalldir'])
+ &&
$parentreg['filelist'][$file2]['baseinstalldir'] === $basedir
+ ) {
+ unset($parentreg['filelist'][$file2]);
+ }
+ }
+
unset($test[$file]);
- unset($parentreg['filelist'][$file]);
}
} else {
if (strtolower($param->getChannel()) != 'pear.php.net') {
@@ -1224,8 +1239,20 @@
}
if (strtolower($info) == strtolower($param->getPackage())) {
+ if (isset($parentreg['filelist'][$file])) {
+ unset($parentreg['filelist'][$file]);
+ } else{
+ $pos = strpos($file, '/');
+ $basedir = substr($file, 0, $pos);
+ $file2 = substr($file, $pos + 1);
+ if
(isset($parentreg['filelist'][$file2]['baseinstalldir'])
+ &&
$parentreg['filelist'][$file2]['baseinstalldir'] === $basedir
+ ) {
+ unset($parentreg['filelist'][$file2]);
+ }
+ }
+
unset($test[$file]);
- unset($parentreg['filelist'][$file]);
}
}
}
@@ -1248,7 +1275,7 @@
}
}
- if (sizeof($test)) {
+ if (count($test)) {
$msg = "$channel/$pkgname: conflicting files found:\n";
$longest = max(array_map("strlen", array_keys($test)));
$fmt = "%${longest}s (%s)\n";
@@ -1370,15 +1397,13 @@
$pkg->setLastInstalledVersion($installregistry->packageInfo($pkg->getPackage(),
'version', $pkg->getChannel()));
foreach ($filelist as $file => $atts) {
+ $this->expectError(PEAR_INSTALLER_FAILED);
if ($pkg->getPackagexmlVersion() == '1.0') {
- $this->expectError(PEAR_INSTALLER_FAILED);
$res = $this->_installFile($file, $atts, $tmp_path, $options);
- $this->popExpect();
} else {
- $this->expectError(PEAR_INSTALLER_FAILED);
$res = $this->_installFile2($pkg, $file, $atts, $tmp_path, $options);
- $this->popExpect();
}
+ $this->popExpect();
if (PEAR::isError($res)) {
if (empty($options['ignore-errors'])) {