Bearsampp 2026.9.23
Loading...
Searching...
No Matches
PEAR_Command_Mirror Class Reference
Inheritance diagram for PEAR_Command_Mirror:
Collaboration diagram for PEAR_Command_Mirror:

Public Member Functions

 __construct (&$ui, &$config)
 doDownloadAll ($command, $options, $params)
& factory ($a)
Public Member Functions inherited from PEAR_Command_Common
 getCommands ()
 getGetoptArgs ($command, &$short_args, &$long_args)
 getHelp ($command)
 getHelpArgs ($command)
 getOptions ($command)
 getShortcuts ()
 run ($command, $options, $params)
Public Member Functions inherited from PEAR
 __call ($method, $arguments)
 __construct ($error_class=null)
 _checkDelExpect ($error_code)
 _PEAR ()
 delExpect ($error_code)
 expectError ($code=' *')
 PEAR ($error_class=null)
 popExpect ()

Data Fields

 $commands
Data Fields inherited from PEAR_Command_Common
 $_deps_rel_trans
 $_deps_type_trans
 $_registry
 $config
 $ui
Data Fields inherited from PEAR
 $_debug = false
 $_default_error_handler = ''
 $_default_error_mode = null
 $_default_error_options = null
 $_error_class = 'PEAR_Error'
 $_expected_errors = array()

Additional Inherited Members

Static Public Member Functions inherited from PEAR
static __callStatic ($method, $arguments)
static getSourceDateEpoch ()
static & getStaticProperty ($class, $var)
static isError ($data, $code=null)
static loadExtension ($ext)
static registerShutdownFunc ($func, $args=array())
static staticPopErrorHandling ()
static staticPushErrorHandling ($mode, $options=null)
Static Protected Member Functions inherited from PEAR
static _popErrorHandling ($object)
static _pushErrorHandling ($object, $mode, $options=null)
static _raiseError ($object, $message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
static _setErrorHandling ( $object, $mode=null, $options=null)
static _throwError ($object, $message=null, $code=null, $userinfo=null)
Static Protected Attributes inherited from PEAR
static $bivalentMethods

Detailed Description

Definition at line 33 of file Mirror.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( & $ui,
& $config )

PEAR_Command_Mirror constructor.

@access public

Parameters
objectPEAR_Frontend a reference to an frontend
objectPEAR_Config a reference to the configuration data

Reimplemented from PEAR_Command_Common.

Definition at line 62 of file Mirror.php.

63 {
64 parent::__construct($ui, $config);
65 }

References PEAR_Command_Common\$config, and PEAR_Command_Common\$ui.

Member Function Documentation

◆ doDownloadAll()

doDownloadAll ( $command,
$options,
$params )

retrieves a list of avaible Packages from master server and downloads them

@access public

Parameters
string$commandthe command
array$optionsthe command options before the command
array$paramsthe stuff after the command name
Returns
bool true if successful
Exceptions
PEAR_Error

Error handling not necessary, because already done by the download command

Definition at line 87 of file Mirror.php.

88 {
89 $savechannel = $this->config->get('default_channel');
90 $reg = &$this->config->getRegistry();
91 $channel = isset($options['channel']) ? $options['channel'] :
92 $this->config->get('default_channel');
93 if (!$reg->channelExists($channel)) {
94 $this->config->set('default_channel', $savechannel);
95 return $this->raiseError('Channel "' . $channel . '" does not exist');
96 }
97 $this->config->set('default_channel', $channel);
98
99 $this->ui->outputData('Using Channel ' . $this->config->get('default_channel'));
100 $chan = $reg->getChannel($channel);
101 if (PEAR::isError($chan)) {
102 return $this->raiseError($chan);
103 }
104
105 if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
106 $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
107 $rest = &$this->config->getREST('1.0', array());
108 $remoteInfo = array_flip($rest->listPackages($base, $channel));
109 }
110
111 if (PEAR::isError($remoteInfo)) {
112 return $remoteInfo;
113 }
114
115 $cmd = &$this->factory("download");
116 if (PEAR::isError($cmd)) {
117 return $cmd;
118 }
119
120 $this->ui->outputData('Using Preferred State of ' .
121 $this->config->get('preferred_state'));
122 $this->ui->outputData('Gathering release information, please wait...');
123
129 $err = $cmd->run('download', array('downloadonly' => true), array_keys($remoteInfo));
131 $this->config->set('default_channel', $savechannel);
132 if (PEAR::isError($err)) {
133 $this->ui->outputData($err->getMessage());
134 }
135
136 return true;
137 }
const PEAR_ERROR_RETURN
Definition PEAR.php:24
static staticPopErrorHandling()
Definition PEAR.php:654
static staticPushErrorHandling($mode, $options=null)
Definition PEAR.php:619
$options
Definition pearcmd.php:145

References $command, $options, factory(), PEAR\isError(), PEAR_ERROR_RETURN, PEAR\staticPopErrorHandling(), and PEAR\staticPushErrorHandling().

Here is the call graph for this function:

◆ factory()

& factory ( $a)

For unit-testing

Definition at line 70 of file Mirror.php.

71 {
72 $a = &PEAR_Command::factory($a, $this->config);
73 return $a;
74 }
static & factory($command, &$config)
Definition Command.php:112

References PEAR_Command\factory().

Referenced by doDownloadAll().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ $commands

$commands
Initial value:
= array(
'download-all' => array(
'summary' => 'Downloads each available package from the default channel',
'function' => 'doDownloadAll',
'shortcut' => 'da',
'options' => array(
'channel' =>
array(
'shortopt' => 'c',
'doc' => 'specify a channel other than the default channel',
'arg' => 'CHAN',
),
),
'doc' => '
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'
),
)

Definition at line 35 of file Mirror.php.


The documentation for this class was generated from the following file:
  • E:/Bearsampp-development/sandbox/core/libs/php/pear/pear/PEAR/Command/Mirror.php