cvs: pear-core /PEAR Config.php

From: Date: Sun, 15 May 2005 02:19:18 +0000
Subject: cvs: pear-core /PEAR Config.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-31863@lists.php.net to get a copy of this message
cellog Sat May 14 22:19:18 2005 EDT Modified files: /pear-core/PEAR Config.php Log: if preferred_mirror is set to a mirror, and then after a channel-update, the mirror no longer exists, we run into some serious trouble. Instead, always return the main channel in this situation http://cvs.php.net/diff.php/pear-core/PEAR/Config.php?r1=1.106&r2=1.107&ty=u Index: pear-core/PEAR/Config.php diff -u pear-core/PEAR/Config.php:1.106 pear-core/PEAR/Config.php:1.107 --- pear-core/PEAR/Config.php:1.106 Wed May 11 15:28:58 2005 +++ pear-core/PEAR/Config.php Sat May 14 22:19:17 2005 @@ -16,7 +16,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Config.php,v 1.106 2005/05/11 19:28:58 cellog Exp $ + * @version CVS: $Id: Config.php,v 1.107 2005/05/15 02:19:17 cellog Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -1181,16 +1181,26 @@ if ($key == '__channels' || $channel == 'pear.php.net') { return null; } + $ret = null; if ($layer === null) { foreach ($this->layers as $ilayer) { if (isset($this->configuration[$ilayer]['__channels'][$channel][$key])) { - return $this->configuration[$ilayer]['__channels'][$channel][$key]; + $ret = $this->configuration[$ilayer]['__channels'][$channel][$key]; } } } elseif (isset($this->configuration[$layer]['__channels'][$channel][$key])) { - return $this->configuration[$layer]['__channels'][$channel][$key]; + $ret = $this->configuration[$layer]['__channels'][$channel][$key]; } if ($key == 'preferred_mirror') { + if ($ret !== null) { + $reg = &$this->getRegistry($layer); + if (is_object($reg)) { + $chan = &$reg->getChannel($channel); + if (!$chan->getMirror($value) && $chan->getName() != $value) { + return $channel; // mirror does not exist + } + } + } if ($channel == $this->getDefaultChannel($layer)) { return $channel; // we must use the channel name as the preferred mirror // if the user has not chosen an alternate

« previous php.pear.cvs (#31863) next »