cvs: pear-core /PEAR/Downloader Package.php

From: Date: Sat, 29 Mar 2008 14:18:37 +0000
Subject: cvs: pear-core /PEAR/Downloader Package.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7416@lists.php.net to get a copy of this message
dufuz Sat Mar 29 14:18:37 2008 UTC Modified files: /pear-core/PEAR/Downloader Package.php Log: make the code in detectStupidDuplicates a lot more redable http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Downloader/Package.php?r1=1.112&r2=1.113&diff_format=u Index: pear-core/PEAR/Downloader/Package.php diff -u pear-core/PEAR/Downloader/Package.php:1.112 pear-core/PEAR/Downloader/Package.php:1.113 --- pear-core/PEAR/Downloader/Package.php:1.112 Thu Jan 3 20:26:36 2008 +++ pear-core/PEAR/Downloader/Package.php Sat Mar 29 14:18:36 2008 @@ -15,7 +15,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 1997-2008 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Package.php,v 1.112 2008/01/03 20:26:36 cellog Exp $ + * @version CVS: $Id: Package.php,v 1.113 2008/03/29 14:18:36 dufuz Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -280,7 +280,7 @@ return $this->_downloader; } - function getType() + function getType() { return $this->_type; } @@ -827,7 +827,7 @@ } function getParsedPackage() - { + { if (isset($this->_packagefile) || isset($this->_parsedname)) { return array('channel' => $this->getChannel(), 'package' => $this->getPackage(), @@ -1153,7 +1153,7 @@ /** * Detect duplicate package names with differing versions - * + * * If a user requests to install Date 1.4.6 and Date 1.4.7, * for instance, this is a logic error. This method * detects this situation. @@ -1166,17 +1166,18 @@ { $existing = array(); foreach ($params as $i => $param) { - if (!isset($existing[$param->getChannel() . '/' . $param->getPackage()])) { - $existing[$param->getChannel() . '/' . $param->getPackage()] = array(); + $package = $param->getPackage(); + $channel = $param->getChannel(); + $group = $param->getGroup(); + if (!isset($existing[$channel . '/' . $package])) { + $existing[$channel . '/' . $package] = array(); } - if (!isset($existing[$param->getChannel() . '/' . $param->getPackage()] - [$param->getGroup()])) { - $existing[$param->getChannel() . '/' . $param->getPackage()] - [$param->getGroup()] = array(); + if (!isset($existing[$channel . '/' . $package][$group])) { + $existing[$channel . '/' . $package][$group] = array(); } - $existing[$param->getChannel() . '/' . $param->getPackage()] - [$param->getGroup()][] = $i; + $existing[$channel . '/' . $package][$group][] = $i; } + $indices = array(); foreach ($existing as $package => $groups) { foreach ($groups as $group => $dupes) { @@ -1185,6 +1186,7 @@ } } } + $indices = array_unique($indices); foreach ($indices as $index) { $errorparams[] = $params[$index]; @@ -1837,7 +1839,7 @@ } if (isset($info['deprecated']) && $info['deprecated']) { $this->_downloader->log(0, - 'WARNING: "' . + 'WARNING: "' . $this->_registry->parsedPackageNameToString( array('channel' => $info['info']->getChannel(), 'package' => $info['info']->getPackage()), true) .

« previous php.pear.core (#7416) next »