function doRemoteInfo($command, $options, $params)
{
if (sizeof($params) != 1) {
return $this->raiseError("{$command} expects one param: the remote package name");
}
$savechannel = $channel = $this->config->get('default_channel');
$reg =& $this->config->getRegistry();
$package = $params[0];
$parsed = $reg->parsePackageName($package, $channel);
if (PEAR::isError($parsed)) {
return $this->raiseError('Invalid package name "' . $package . '"');
}
$channel = $parsed['channel'];
$this->config->set('default_channel', $channel);
$chan = $reg->getChannel($channel);
if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
return $e;
}
$mirror = $this->config->get('preferred_mirror');
if ($chan->supportsREST($mirror) && ($base = $chan->getBaseURL('REST1.0', $mirror))) {
$rest =& $this->config->getREST('1.0', array());
$info = $rest->packageInfo($base, $parsed['package'], $channel);
}
if (!isset($info)) {
return $this->raiseError('No supported protocol was found');
}
if (PEAR::isError($info)) {
$this->config->set('default_channel', $savechannel);
return $this->raiseError($info);
}
if (!isset($info['name'])) {
return $this->raiseError('No remote package "' . $package . '" was found');
}
$installed = $reg->packageInfo($info['name'], null, $channel);
$info['installed'] = $installed['version'] ? $installed['version'] : '- no -';
if (is_array($info['installed'])) {
$info['installed'] = $info['installed']['release'];
}
$this->ui->outputData($info, $command);
$this->config->set('default_channel', $savechannel);
return true;
}