本文整理汇总了PHP中PEAR_PackageFile::getChannel方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile::getChannel方法的具体用法?PHP PEAR_PackageFile::getChannel怎么用?PHP PEAR_PackageFile::getChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_PackageFile
的用法示例。
在下文中一共展示了PEAR_PackageFile::getChannel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChannel
function getChannel()
{
if (isset($this->_packagefile)) {
return $this->_packagefile->getChannel();
} elseif (isset($this->_downloadURL['info'])) {
return $this->_downloadURL['info']->getChannel();
}
return false;
}
示例2: doInstall
function doInstall($command, $options, $params)
{
if (!class_exists('PEAR_PackageFile')) {
require_once 'PEAR/PackageFile.php';
}
if (empty($this->installer)) {
$this->installer =& $this->getInstaller($this->ui);
}
if ($command == 'upgrade' || $command == 'upgrade-all') {
$options['upgrade'] = true;
} else {
$packages = $params;
}
if (isset($options['installroot']) && isset($options['packagingroot'])) {
return $this->raiseError('ERROR: cannot use both --installroot and --packagingroot');
}
$reg =& $this->config->getRegistry();
$instreg =& $reg;
// instreg used to check if package is installed
if (isset($options['packagingroot']) && !isset($options['upgrade'])) {
$packrootphp_dir = $this->installer->_prependPath($this->config->get('php_dir', null, 'pear.php.net'), $options['packagingroot']);
$instreg = new PEAR_Registry($packrootphp_dir);
// other instreg!
if ($this->config->get('verbose') > 2) {
$this->ui->outputData('using package root: ' . $options['packagingroot']);
}
}
$abstractpackages = array();
$otherpackages = array();
// parse params
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
foreach ($params as $param) {
if (strpos($param, 'http://') === 0) {
$otherpackages[] = $param;
continue;
}
if (strpos($param, 'channel://') === false && @file_exists($param)) {
if (isset($options['force'])) {
$otherpackages[] = $param;
continue;
}
$pkg = new PEAR_PackageFile($this->config);
$pf = $pkg->fromAnyFile($param, PEAR_VALIDATE_DOWNLOADING);
if (PEAR::isError($pf)) {
$otherpackages[] = $param;
continue;
}
if ($reg->packageExists($pf->getPackage(), $pf->getChannel()) && version_compare($pf->getVersion(), $reg->packageInfo($pf->getPackage(), 'version', $pf->getChannel()), '<=')) {
if ($this->config->get('verbose')) {
$this->ui->outputData('Ignoring installed package ' . $reg->parsedPackageNameToString(array('package' => $pf->getPackage(), 'channel' => $pf->getChannel()), true));
}
continue;
}
$otherpackages[] = $param;
continue;
}
$e = $reg->parsePackageName($param, $this->config->get('default_channel'));
if (PEAR::isError($e)) {
$otherpackages[] = $param;
} else {
$abstractpackages[] = $e;
}
}
PEAR::staticPopErrorHandling();
// if there are any local package .tgz or remote static url, we can't
// filter. The filter only works for abstract packages
if (count($abstractpackages) && !isset($options['force'])) {
// when not being forced, only do necessary upgrades/installs
if (isset($options['upgrade'])) {
$abstractpackages = $this->_filterUptodatePackages($abstractpackages, $command);
} else {
foreach ($abstractpackages as $i => $package) {
if (isset($package['group'])) {
// do not filter out install groups
continue;
}
if ($instreg->packageExists($package['package'], $package['channel'])) {
if ($this->config->get('verbose')) {
$this->ui->outputData('Ignoring installed package ' . $reg->parsedPackageNameToString($package, true));
}
unset($abstractpackages[$i]);
}
}
}
$abstractpackages = array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
} elseif (count($abstractpackages)) {
$abstractpackages = array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
}
$packages = array_merge($abstractpackages, $otherpackages);
if (!count($packages)) {
$this->ui->outputData('Nothing to ' . $command);
return true;
}
$this->downloader =& $this->getDownloader($this->ui, $options, $this->config);
$errors = array();
$binaries = array();
$downloaded = array();
$downloaded =& $this->downloader->download($packages);
if (PEAR::isError($downloaded)) {
return $this->raiseError($downloaded);
//.........这里部分代码省略.........