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

From: Date: Sat, 07 Mar 2009 21:18:25 +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-8244@lists.php.net to get a copy of this message
dufuz Sat Mar 7 21:18:25 2009 UTC Modified files: /pear-core/PEAR/Downloader Package.php Log: * Fix Bug #15914: pear upgrade installs different version if desired version not found [dufuz] http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Downloader/Package.php?r1=1.124&r2=1.125&diff_format=u Index: pear-core/PEAR/Downloader/Package.php diff -u pear-core/PEAR/Downloader/Package.php:1.124 pear-core/PEAR/Downloader/Package.php:1.125 --- pear-core/PEAR/Downloader/Package.php:1.124 Tue Feb 24 23:45:52 2009 +++ pear-core/PEAR/Downloader/Package.php Sat Mar 7 21:18:25 2009 @@ -9,7 +9,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: Package.php,v 1.124 2009/02/24 23:45:52 dufuz Exp $ + * @version CVS: $Id: Package.php,v 1.125 2009/03/07 21:18:25 dufuz Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -1802,9 +1802,9 @@ $preferred_state = $this->_config->get('preferred_state'); if (!isset($info['url'])) { if ($this->isInstalled($info)) { - if ($isdependency && version_compare($info['version'], - $this->_registry->packageInfo($info['info']->getPackage(), - 'version', $info['info']->getChannel()), '<=')) { + $package_version = $this->_registry->packageInfo($info['info']->getPackage(), + 'version', $info['info']->getChannel()); + if ($isdependency && version_compare($info['version'], $package_version, '<=')) { // ignore bogus errors of "failed to download dependency" // if it is already installed and the one that would be // downloaded is older or the same version (Bug #7219) @@ -1812,6 +1812,26 @@ } } + if ($info['version'] === $package_version) { + if (!isset($options['soft'])) { + $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . + '/' . $pname['package'] . '-' . $pname['version'] . ', additionally the suggested version' . + ' (' . $package_version . ') is the same as the locally installed one.'); + } + + return false; + } + + if (version_compare($info['version'], $package_version, '<=')) { + if (!isset($options['soft'])) { + $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . + '/' . $pname['package'] . '-' . $pname['version'] . ', additionally the suggested version' . + ' (' . $info['version'] . ') is a lower version than the locally installed one (' . $package_version . ').'); + } + + return false; + } + $instead = ', will instead download version ' . $info['version'] . ', stability "' . $info['info']->getState() . '"'; // releases exist, but we failed to get any @@ -1943,7 +1963,7 @@ // the state against the installed package, this allows upgrades for packages // with lower stability than the preferred_state $stability = $this->_registry->packageInfo($pname['package'], 'stability', $pname['channel']); - if ($stability === null + if (!$this->isInstalled($info) || !in_array($info['info']->getState(), PEAR_Common::betterStates($stability['release'], true)) ) { $err = PEAR::raiseError(

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