Source for file Mirror.php
Documentation is available at Mirror.php
* PEAR_Command_Mirror (download-all command)
* @author Alexander Merz <alexmerz@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: Mirror.php 313023 2011-07-06 19:17:11Z dufuz $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.2.0
require_once 'PEAR/Command/Common.php';
* PEAR commands for providing file mirrors
* @author Alexander Merz <alexmerz@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.9.4
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.2.0
'summary' => 'Downloads each available package from the default channel',
'function' => 'doDownloadAll',
'doc' => 'specify a channel other than the default channel',
Requests a list of available packages from the default channel ({config default_channel})
and downloads them to current working directory. Note: only
packages within preferred_state ({config preferred_state}) will be downloaded'
* PEAR_Command_Mirror constructor.
* @param object PEAR_Frontend a reference to an frontend
* @param object PEAR_Config a reference to the configuration data
* retrieves a list of avaible Packages from master server
* @param string $command the command
* @param array $options the command options before the command
* @param array $params the stuff after the command name
* @return bool true if succesful
$savechannel = $this->config->get ('default_channel');
$reg = &$this->config->getRegistry ();
$channel = isset ($options['channel']) ? $options['channel'] :
$this->config->get ('default_channel');
if (!$reg->channelExists ($channel)) {
$this->config->set ('default_channel', $savechannel);
return $this->raiseError('Channel "' . $channel . '" does not exist');
$this->config->set ('default_channel', $channel);
$this->ui->outputData ('Using Channel ' . $this->config->get ('default_channel'));
$chan = $reg->getChannel ($channel);
if ($chan->supportsREST ($this->config->get ('preferred_mirror')) &&
$base = $chan->getBaseURL ('REST1.0', $this->config->get ('preferred_mirror'))) {
$rest = &$this->config->getREST ('1.0', array ());
$remoteInfo = array_flip($rest->listPackages ($base, $channel));
$cmd = &$this->factory("download");
$this->ui->outputData ('Using Preferred State of ' .
$this->config->get ('preferred_state'));
$this->ui->outputData ('Gathering release information, please wait...');
* Error handling not necessary, because already done by
$err = $cmd->run ('download', array ('downloadonly' => true ), array_keys($remoteInfo));
$this->config->set ('default_channel', $savechannel);
$this->ui->outputData ($err->getMessage ());
Documentation generated on Wed, 06 Jul 2011 23:30:56 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.
|