function discover($channel)
    {
        $this->log(1, 'Attempting to discover channel "' . $channel . '"...');
        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
        $callback = $this->ui ? array(&$this, '_downloadCallback') : null;
        if (!class_exists('System')) {
            require_once 'System.php';
        }

        $tmpdir = $this->config->get('temp_dir');
        $tmp = System::mktemp('-d -t "' . $tmpdir . '"');
        $a   = $this->downloadHttp('http://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
        PEAR::popErrorHandling();
        if (PEAR::isError($a)) {
            // Attempt to fallback to https automatically.
            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
            $this->log(1, 'Attempting fallback to https instead of http on channel "' . $channel . '"...');
            $a = $this->downloadHttp('https://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
            PEAR::popErrorHandling();
            if (PEAR::isError($a)) {
                return false;
            }
        }

        list($a, $lastmodified) = $a;
        if (!class_exists('PEAR_ChannelFile')) {
            require_once 'PEAR/ChannelFile.php';
        }

        $b = new PEAR_ChannelFile;
        if ($b->fromXmlFile($a)) {
            unlink($a);
            if ($this->config->get('auto_discover')) {
                $this->_registry->addChannel($b, $lastmodified);
                $alias = $b->getName();
                if ($b->getName() == $this->_registry->channelName($b->getAlias())) {
                    $alias = $b->getAlias();
                }

                $this->log(1, 'Auto-discovered channel "' . $channel .
                    '", alias "' . $alias . '", adding to registry');
            }

            return true;
        }

        unlink($a);
        return false;
    }
function discover($channel)
    {
        $this->log(1, 'Attempting to discover channel "' . $channel . '"...');
        PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
        $callback = $this->ui ? array(&$this, '_downloadCallback') : null;
        if (!class_exists('System')) {
            require_once 'System.php';
        }

        $tmpdir = $this->config->get('temp_dir');
        $tmp = System::mktemp('-d -t "' . $tmpdir . '"');
        $a   = $this->downloadHttp('http://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
        PEAR::popErrorHandling();
        if (PEAR::isError($a)) {
            // Attempt to fallback to https automatically.
            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
            $this->log(1, 'Attempting fallback to https instead of http on channel "' . $channel . '"...');
            $a = $this->downloadHttp('https://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
            PEAR::popErrorHandling();
            if (PEAR::isError($a)) {
                return false;
            }
        }

        list($a, $lastmodified) = $a;
        if (!class_exists('PEAR_ChannelFile')) {
            require_once 'PEAR/ChannelFile.php';
        }

        $b = new PEAR_ChannelFile;
        if ($b->fromXmlFile($a)) {
            unlink($a);
            if ($this->config->get('auto_discover')) {
                $this->_registry->addChannel($b, $lastmodified);
                $alias = $b->getName();
                if ($b->getName() == $this->_registry->channelName($b->getAlias())) {
                    $alias = $b->getAlias();
                }

                $this->log(1, 'Auto-discovered channel "' . $channel .
                    '", alias "' . $alias . '", adding to registry');
            }

            return true;
        }

        unlink($a);
        return false;
    }
function discover ( $ channel ) { $ this -> log ( 1 , 'Attempting to discover channel "' . $ channel . '"...' ) ; PEAR :: pushErrorHandling ( PEAR_ERROR_RETURN ) ; $ callback = $ this -> ui ? array ( & $ this , '_downloadCallback' ) : null ; if ( ! class_exists ( 'System' ) ) { require_once 'System.php' ; } $ tmpdir = $ this -> config -> get ( 'temp_dir' ) ; $ tmp = System :: mktemp ( '-d -t "' . $ tmpdir . '"' ) ; $ a = $ this -> downloadHttp ( 'http://' . $ channel . '/channel.xml' , $ this -> ui , $ tmp , $ callback , false ) ; PEAR :: popErrorHandling ( ) ; if ( PEAR :: isError ( $ a ) ) { // Attempt to fallback to https automatically. PEAR :: pushErrorHandling ( PEAR_ERROR_RETURN ) ; $ this -> log ( 1 , 'Attempting fallback to https instead of http on channel "' . $ channel . '"...' ) ; $ a = $ this -> downloadHttp ( 'https://' . $ channel . '/channel.xml' , $ this -> ui , $ tmp , $ callback , false ) ; PEAR :: popErrorHandling ( ) ; if ( PEAR :: isError ( $ a ) ) { return false ; } } list ( $ a , $ lastmodified ) = $ a ; if ( ! class_exists ( 'PEAR_ChannelFile' ) ) { require_once 'PEAR/ChannelFile.php' ; } $ b = new PEAR_ChannelFile ; if ( $ b -> fromXmlFile ( $ a ) ) { unlink ( $ a ) ; if ( $ this -> config -> get ( 'auto_discover' ) ) { $ this -> _registry -> addChannel ( $ b , $ lastmodified ) ; $ alias = $ b -> getName ( ) ; if ( $ b -> getName ( ) == $ this -> _registry -> channelName ( $ b -> getAlias ( ) ) ) { $ alias = $ b -> getAlias ( ) ; } $ this -> log ( 1 , 'Auto-discovered channel "' . $ channel . '", alias "' . $ alias . '", adding to registry' ) ; } return true ; } unlink ( $ a ) ; return false ; }
Attempt to discover a channel's remote capabilities from
its server name
@param string
@return boolean
Attempt to discover a channel s remote capabilities from its server name