From 39105b9927632326995b46147fcfdb6fc1237fab Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Sun, 31 Aug 2003 06:53:46 +0000 Subject: [PATCH] This patch should fix all unintended upgrading/installation of packages less stable than preferred state --- pear/PEAR/Installer.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php index d4057f4e8c..12bb502d5b 100644 --- a/pear/PEAR/Installer.php +++ b/pear/PEAR/Installer.php @@ -566,6 +566,13 @@ class PEAR_Installer extends PEAR_Common if (!$willinstall) { $willinstall = array(); } + if (!$state) { + $state = $config->get('preferred_state'); + if (!$state) { + // don't inadvertantly use a non-set preferred_state + $state = null; + } + } $mywillinstall = array(); $php_dir = $config->get('php_dir'); if (isset($options['installroot'])) { @@ -582,6 +589,10 @@ class PEAR_Installer extends PEAR_Common // download files in this list if necessary foreach($packages as $pkgfile) { $pkgfile = $this->extractDownloadFileName($pkgfile, $version); + if ($version === null) { + // use preferred state if no version number was specified + $version = $state; + } if ($this->validPackageName($pkgfile) && !isset($options['upgrade'])) { if ($this->registry->packageExists($pkgfile)) { $this->log(0, "Package '$pkgfile' already installed, skipping"); @@ -609,7 +620,6 @@ class PEAR_Installer extends PEAR_Common if (isset($options['alldeps']) || isset($options['onlyreqdeps'])) { $reg = new PEAR_Registry($config->get('php_dir')); if (!$installed) { - $state = $config->get('preferred_state'); $installed = $reg->listPackages(); array_walk($installed, create_function('&$v,$k','$v = strtolower($v);')); $installed = array_flip($installed); -- 2.40.0