function doRemoteList($command, $options, $params)
{
$savechannel = $channel = $this->config->get('default_channel');
$reg =& $this->config->getRegistry();
if (isset($options['channel'])) {
$channel = $options['channel'];
if (!$reg->channelExists($channel)) {
return $this->raiseError('Channel "' . $channel . '" does not exist');
}
$this->config->set('default_channel', $channel);
}
$chan = $reg->getChannel($channel);
if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
return $e;
}
$list_options = false;
if ($this->config->get('preferred_state') == 'stable') {
$list_options = true;
}
$available = array();
if ($chan->supportsREST($this->config->get('preferred_mirror')) && ($base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror')))) {
// use faster list-all if available
$rest =& $this->config->getREST('1.1', array());
$available = $rest->listAll($base, $list_options, true, false, false, $chan->getName());
} elseif ($chan->supportsREST($this->config->get('preferred_mirror')) && ($base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror')))) {
$rest =& $this->config->getREST('1.0', array());
$available = $rest->listAll($base, $list_options, true, false, false, $chan->getName());
}
if (PEAR::isError($available)) {
$this->config->set('default_channel', $savechannel);
return $this->raiseError($available);
}
$i = $j = 0;
$data = array('caption' => 'Channel ' . $channel . ' Available packages:', 'border' => true, 'headline' => array('Package', 'Version'), 'channel' => $channel);
if (count($available) == 0) {
$data = '(no packages available yet)';
} else {
foreach ($available as $name => $info) {
$version = isset($info['stable']) && $info['stable'] ? $info['stable'] : '-n/a-';
$data['data'][] = array($name, $version);
}
}
$this->ui->outputData($data, $command);
$this->config->set('default_channel', $savechannel);
return true;
}