本文整理汇总了PHP中PEAR_DependencyDB::getDependentPackageDependencies方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_DependencyDB::getDependentPackageDependencies方法的具体用法?PHP PEAR_DependencyDB::getDependentPackageDependencies怎么用?PHP PEAR_DependencyDB::getDependentPackageDependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_DependencyDB
的用法示例。
在下文中一共展示了PEAR_DependencyDB::getDependentPackageDependencies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validatePackage
/**
* validate a downloaded package against installed packages
*
* As of PEAR 1.4.3, this will only validate
*
* @param array|PEAR_Downloader_Package|PEAR_PackageFile_v1|PEAR_PackageFile_v2
* $pkg package identifier (either
* array('package' => blah, 'channel' => blah) or an array with
* index 'info' referencing an object)
* @param PEAR_Downloader $dl
* @param array $params full list of packages to install
* @return true|PEAR_Error
*/
function validatePackage($pkg, &$dl, $params = array())
{
if (is_array($pkg) && isset($pkg['info'])) {
$deps = $this->_dependencydb->getDependentPackageDependencies($pkg['info']);
} else {
$deps = $this->_dependencydb->getDependentPackageDependencies($pkg);
}
$fail = false;
if ($deps) {
if (!class_exists('PEAR_Downloader_Package')) {
require_once 'PEAR/Downloader/Package.php';
}
$dp =& new PEAR_Downloader_Package($dl);
if (is_object($pkg)) {
$dp->setPackageFile($pkg);
} else {
$dp->setDownloadURL($pkg);
}
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
foreach ($deps as $channel => $info) {
foreach ($info as $package => $ds) {
foreach ($params as $packd) {
if (strtolower($packd->getPackage()) == strtolower($package) && $packd->getChannel() == $channel) {
$dl->log(3, 'skipping installed package check of "' . $this->_registry->parsedPackageNameToString(array('channel' => $channel, 'package' => $package), true) . '", version "' . $packd->getVersion() . '" will be ' . 'downloaded and installed');
continue 2;
// jump to next package
}
}
foreach ($ds as $d) {
$checker =& new PEAR_Dependency2($this->_config, $this->_options, array('channel' => $channel, 'package' => $package), $this->_state);
$dep = $d['dep'];
$required = $d['type'] == 'required';
$ret = $checker->_validatePackageDownload($dep, $required, array(&$dp));
if (is_array($ret)) {
$dl->log(0, $ret[0]);
} elseif (PEAR::isError($ret)) {
$dl->log(0, $ret->getMessage());
$fail = true;
}
}
}
}
PEAR::popErrorHandling();
}
if ($fail) {
return $this->raiseError('%s cannot be installed, conflicts with installed packages');
}
return true;
}
示例2: validatePackage
function validatePackage($pkg, &$dl)
{
if (is_array($pkg) && isset($pkg['info'])) {
$deps = $this->_dependencydb->getDependentPackageDependencies($pkg['info']);
} else {
$deps = $this->_dependencydb->getDependentPackageDependencies($pkg);
}
$fail = false;
if ($deps) {
if (!class_exists('PEAR_Downloader_Package')) {
require_once 'PEAR/Downloader/Package.php';
}
$dp =& new PEAR_Downloader_Package($dl);
if (is_object($pkg)) {
$dp->setPackageFile($pkg);
} else {
$dp->setDownloadURL($pkg);
}
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
foreach ($deps as $channel => $info) {
foreach ($info as $package => $ds) {
foreach ($ds as $d) {
$checker =& new PEAR_Dependency2($this->_config, $this->_options, array('channel' => $channel, 'package' => $package), $this->_state);
$dep = $d['dep'];
$required = $d['type'] == 'required';
$ret = $checker->_validatePackageDownload($dep, $required, array(&$dp));
if (is_array($ret)) {
$dl->log(0, $ret[0]);
} elseif (PEAR::isError($ret)) {
$dl->log(0, $ret->getMessage());
$fail = true;
}
}
}
}
PEAR::popErrorHandling();
}
if ($fail) {
return $this->raiseError('%s cannot be installed, conflicts with installed packages');
}
return true;
}