本文整理汇总了PHP中PEAR_PackageFile_v1::setDeps方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile_v1::setDeps方法的具体用法?PHP PEAR_PackageFile_v1::setDeps怎么用?PHP PEAR_PackageFile_v1::setDeps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_PackageFile_v1
的用法示例。
在下文中一共展示了PEAR_PackageFile_v1::setDeps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
/**
* @param array dependency array
* @access private
*/
function _getDepPackageDownloadUrl($dep, $parr)
{
$xsdversion = isset($dep['rel']) ? '1.0' : '2.0';
$curchannel = $this->config->get('default_channel');
if (isset($dep['uri'])) {
$xsdversion = '2.0';
$chan =& $this->_registry->getChannel('__uri');
if (PEAR::isError($chan)) {
return $chan;
}
$version = $this->_registry->packageInfo($dep['name'], 'version', '__uri');
$this->configSet('default_channel', '__uri');
} else {
if (isset($dep['channel'])) {
$remotechannel = $dep['channel'];
} else {
$remotechannel = 'pear.php.net';
}
if (!$this->_registry->channelExists($remotechannel)) {
do {
if ($this->config->get('auto_discover')) {
if ($this->discover($remotechannel)) {
break;
}
}
return PEAR::raiseError('Unknown remote channel: ' . $remotechannel);
} while (false);
}
$chan =& $this->_registry->getChannel($remotechannel);
if (PEAR::isError($chan)) {
return $chan;
}
$version = $this->_registry->packageInfo($dep['name'], 'version', $remotechannel);
$this->configSet('default_channel', $remotechannel);
}
$state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
if (isset($parr['state']) && isset($parr['version'])) {
unset($parr['state']);
}
if (isset($dep['uri'])) {
$info =& $this->newDownloaderPackage($this);
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$err = $info->initialize($dep);
PEAR::staticPopErrorHandling();
if (!$err) {
// skip parameters that were missed by preferred_state
return PEAR::raiseError('Cannot initialize dependency');
}
if (PEAR::isError($err)) {
if (!isset($this->_options['soft'])) {
$this->log(0, $err->getMessage());
}
if (is_object($info)) {
$param = $info->getChannel() . '/' . $info->getPackage();
}
return PEAR::raiseError('Package "' . $param . '" is not valid');
}
return $info;
} elseif ($chan->supportsREST($this->config->get('preferred_mirror')) && (($base2 = $chan->getBaseURL('REST1.3', $this->config->get('preferred_mirror'))) || ($base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))))) {
if ($base2) {
$base = $base2;
$rest =& $this->config->getREST('1.3', $this->_options);
} else {
$rest =& $this->config->getREST('1.0', $this->_options);
}
$url = $rest->getDepDownloadURL($base, $xsdversion, $dep, $parr, $state, $version, $chan->getName());
if (PEAR::isError($url)) {
return $url;
}
if ($parr['channel'] != $curchannel) {
$this->configSet('default_channel', $curchannel);
}
if (!is_array($url)) {
return $url;
}
$url['raw'] = false;
// no checking is necessary for REST
if (!is_array($url['info'])) {
return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' . 'this should never happen');
}
if (isset($url['info']['required'])) {
if (!class_exists('PEAR_PackageFile_v2')) {
require_once 'PEAR/PackageFile/v2.php';
}
$pf = new PEAR_PackageFile_v2();
$pf->setRawChannel($remotechannel);
} else {
if (!class_exists('PEAR_PackageFile_v1')) {
require_once 'PEAR/PackageFile/v1.php';
}
$pf = new PEAR_PackageFile_v1();
}
$pf->setRawPackage($url['package']);
$pf->setDeps($url['info']);
if ($url['compatible']) {
$pf->setCompatible($url['compatible']);
//.........这里部分代码省略.........
示例2: isset
/**
* @param array dependency array
* @access private
*/
function _getDepPackageDownloadUrl($dep, $parr)
{
$xsdversion = isset($dep['rel']) ? '1.0' : '2.0';
$curchannel = $this->config->get('default_channel');
if (isset($dep['channel'])) {
$remotechannel = $dep['channel'];
} else {
$remotechannel = 'pear.php.net';
}
if (!$this->_registry->channelExists($remotechannel)) {
do {
if ($this->config->get('auto_discover')) {
if ($this->discover($remotechannel)) {
break;
}
}
return PEAR::raiseError('Unknown remote channel: ' . $remotechannel);
} while (false);
}
$this->configSet('default_channel', $remotechannel);
$state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
if (isset($parr['state']) && isset($parr['version'])) {
unset($parr['state']);
}
$chan =& $this->_registry->getChannel($remotechannel);
if (PEAR::isError($chan)) {
return $chan;
}
$version = $this->_registry->packageInfo($dep['name'], 'version', $remotechannel);
if ($chan->supportsREST($this->config->get('preferred_mirror')) && ($base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror')))) {
$rest =& $this->config->getREST('1.0', $this->_options);
$url = $rest->getDepDownloadURL($base, $xsdversion, $dep, $parr, $state, $version);
if (PEAR::isError($url)) {
return $url;
}
if ($parr['channel'] != $curchannel) {
$this->configSet('default_channel', $curchannel);
}
if (!is_array($url)) {
return $url;
}
$url['raw'] = false;
// no checking is necessary for REST
if (!is_array($url['info'])) {
return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' . 'this should never happen');
}
if (isset($url['info']['required'])) {
if (!class_exists('PEAR_PackageFile_v2')) {
require_once 'PEAR/PackageFile/v2.php';
}
$pf = new PEAR_PackageFile_v2();
$pf->setRawChannel($remotechannel);
} else {
if (!class_exists('PEAR_PackageFile_v1')) {
require_once 'PEAR/PackageFile/v1.php';
}
$pf = new PEAR_PackageFile_v1();
}
$pf->setRawPackage($url['package']);
$pf->setDeps($url['info']);
$pf->setRawState($url['stability']);
$url['info'] =& $pf;
if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) {
$ext = '.tar';
} else {
$ext = '.tgz';
}
if (is_array($url)) {
if (isset($url['url'])) {
$url['url'] .= $ext;
}
}
return $url;
} elseif ($chan->supports('xmlrpc', 'package.getDepDownloadURL', false, '1.1')) {
if ($version) {
$url = $this->_remote->call('package.getDepDownloadURL', $xsdversion, $dep, $parr, $state, $version);
} else {
$url = $this->_remote->call('package.getDepDownloadURL', $xsdversion, $dep, $parr, $state);
}
} else {
$url = $this->_remote->call('package.getDepDownloadURL', $xsdversion, $dep, $parr, $state);
}
if ($parr['channel'] != $curchannel) {
$this->configSet('default_channel', $curchannel);
}
if (!is_array($url)) {
return $url;
}
if (isset($url['__PEAR_ERROR_CLASS__'])) {
return PEAR::raiseError($url['message']);
}
$url['raw'] = $url['info'];
$pkg =& $this->getPackagefileObject($this->config, $this->debug);
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$pinfo =& $pkg->fromXmlString($url['info'], PEAR_VALIDATE_DOWNLOADING, 'remote');
PEAR::staticPopErrorHandling();
//.........这里部分代码省略.........