本文整理匯總了PHP中PEAR_Registry::channelAlias方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_Registry::channelAlias方法的具體用法?PHP PEAR_Registry::channelAlias怎麽用?PHP PEAR_Registry::channelAlias使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PEAR_Registry
的用法示例。
在下文中一共展示了PEAR_Registry::channelAlias方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validatePackageUninstall
//.........這裏部分代碼省略.........
}
}
// next remove any packages from the parents list that are not passed in for
// uninstallation
foreach ($allparents as $parent => $d1) {
foreach ($d1 as $d) {
foreach ($params as $param) {
if (strtolower($param->getChannel()) == $d[0][0]['channel'] && strtolower($param->getPackage()) == $d[0][0]['package']) {
// found it
continue 3;
}
}
$remove[$parent] = true;
}
}
// remove all packages whose dependencies fail
// save which ones failed for error reporting
$badchildren = array();
do {
$fail = false;
foreach ($remove as $package => $unused) {
if (!isset($allparents[$package])) {
continue;
}
foreach ($allparents[$package] as $kid => $d1) {
foreach ($d1 as $depinfo) {
if ($depinfo[1]['type'] != 'optional') {
if (isset($badchildren[$kid])) {
continue;
}
$badchildren[$kid] = true;
$remove[$kid] = true;
$fail = true;
continue 2;
}
}
}
if ($fail) {
// start over, we removed some children
continue 2;
}
}
} while ($fail);
// next, construct the list of packages that can't be uninstalled
$badpackages = array();
$save = $this->_currentPackage;
foreach ($perpackagelist as $package => $packagedeps) {
foreach ($packagedeps as $parent) {
if (!isset($remove[$parent[0]])) {
continue;
}
$packagename = $this->_registry->parsePackageName($parent[0]);
$packagename['channel'] = $this->_registry->channelAlias($packagename['channel']);
$pa = $this->_registry->getPackage($packagename['package'], $packagename['channel']);
$packagename['package'] = $pa->getPackage();
$this->_currentPackage = $packagename;
// parent is not present in uninstall list, make sure we can actually
// uninstall it (parent dep is optional)
$parentname['channel'] = $this->_registry->channelAlias($parent[1]['dep']['channel']);
$pa = $this->_registry->getPackage($parent[1]['dep']['name'], $parent[1]['dep']['channel']);
$parentname['package'] = $pa->getPackage();
$parent[1]['dep']['package'] = $parentname['package'];
$parent[1]['dep']['channel'] = $parentname['channel'];
if ($parent[1]['type'] == 'optional') {
$test = $this->_validatePackageUninstall($parent[1]['dep'], false, $dl);
if ($test !== true) {
$badpackages[$package]['warnings'][] = $test;
}
} else {
$test = $this->_validatePackageUninstall($parent[1]['dep'], true, $dl);
if ($test !== true) {
$badpackages[$package]['errors'][] = $test;
}
}
}
}
$this->_currentPackage = $save;
$dl->___uninstall_package_cache = $badpackages;
if (isset($badpackages[$memyselfandI])) {
if (isset($badpackages[$memyselfandI]['warnings'])) {
foreach ($badpackages[$memyselfandI]['warnings'] as $warning) {
$dl->log(0, $warning[0]);
}
}
if (isset($badpackages[$memyselfandI]['errors'])) {
foreach ($badpackages[$memyselfandI]['errors'] as $error) {
if (is_array($error)) {
$dl->log(0, $error[0]);
} else {
$dl->log(0, $error->getMessage());
}
}
if (isset($this->_options['nodeps']) || isset($this->_options['force'])) {
return $this->warning('warning: %s should not be uninstalled, other installed packages depend ' . 'on this package');
}
return $this->raiseError('%s cannot be uninstalled, other installed packages depend on this package');
}
}
return true;
}