function doDownload($command, $options, $params) { //$params[0] -> The package to download if (count($params) != 1) { return PEAR::raiseError("download expects one argument: the package to download"); } $server = $this->config->get('master_server'); if (!ereg('^http://', $params[0])) { $pkgfile = "http://{$server}/get/{$params['0']}"; } else { $pkgfile = $params[0]; } $this->bytes_downloaded = 0; $saved = PEAR_Common::downloadHttp($pkgfile, $this->ui, '.', array(&$this, 'downloadCallback')); if (PEAR::isError($saved)) { return $this->raiseError($saved); } $fname = basename($saved); $this->ui->outputData("File {$fname} downloaded ({$this->bytes_downloaded} bytes)", $command); return true; }