cvs: pear-core /PEAR Downloader.php

From: Date: Mon, 23 May 2005 02:08:35 +0000
Subject: cvs: pear-core /PEAR Downloader.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-32017@lists.php.net to get a copy of this message
cellog Sun May 22 22:08:35 2005 EDT Modified files: /pear-core/PEAR Downloader.php Log: add autodiscover to getdownloadurl() methods fix failure warning in _analyzeDependencies() http://cvs.php.net/diff.php/pear-core/PEAR/Downloader.php?r1=1.83&r2=1.84&ty=u Index: pear-core/PEAR/Downloader.php diff -u pear-core/PEAR/Downloader.php:1.83 pear-core/PEAR/Downloader.php:1.84 --- pear-core/PEAR/Downloader.php:1.83 Sat May 21 12:36:06 2005 +++ pear-core/PEAR/Downloader.php Sun May 22 22:08:35 2005 @@ -18,7 +18,7 @@ * @author Martin Jansen <mj@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Downloader.php,v 1.83 2005/05/21 16:36:06 cellog Exp $ + * @version CVS: $Id: Downloader.php,v 1.84 2005/05/23 02:08:35 cellog Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.0 */ @@ -187,6 +187,12 @@ } } + /** + * Attempt to discover a channel's remote capabilities from + * its server name + * @param string + * @return boolean + */ function discover($channel) { $this->log(1, 'Attempting to discover channel "' . $channel . '"...'); @@ -369,7 +375,7 @@ */ function analyzeDependencies(&$params) { - $failed = false; + $hasfailed = $failed = false; if (isset($this->_options['downloadonly'])) { return; } @@ -534,6 +540,7 @@ $params[$i]->setValidated(); } if ($failed) { + $hasfailed = true; $params[$i] = false; $reset = true; $redo = true; @@ -544,8 +551,8 @@ } } PEAR::staticPopErrorHandling(); - if (isset($this->_options['ignore-errors']) || - isset($this->_options['nodeps'])) { + if ($hasfailed && (isset($this->_options['ignore-errors']) || + isset($this->_options['nodeps']))) { // this is probably not needed, but just in case if (!isset($this->_options['soft'])) { $this->log(0, 'WARNING: dependencies failed'); @@ -638,6 +645,16 @@ // on the latest release as array(version, info). On success it contains // array(version, info, download url string) $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state'); + if (!$this->_registry->channelExists($parr['channel'])) { + do { + if ($this->config->get('auto_discover')) { + if ($this->discover($parr['channel'])) { + break; + } + } + return PEAR::raiseError('Unknown remote channel: ' . $remotechannel); + } while (false); + } $chan = &$this->_registry->getChannel($parr['channel']); $version = $this->_registry->packageInfo($parr['package'], 'version', $parr['channel']); @@ -757,6 +774,16 @@ } else { $remotechannel = 'pear.php.net'; } + if (!$this->_registry->channelExists($remotechannel)) { + do { + if ($this->config->get('auto_discover')) { + if ($this->discover($remotechannel)) { + break; + } + } + return PEAR::raiseError('Unknown remote channel: ' . $remotechannel); + } while (false); + } $this->configSet('default_channel', $remotechannel); $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state'); if (isset($parr['state']) && isset($parr['version'])) {

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