本文整理汇总了PHP中PEAR_Common::_getRevPkgDeps方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Common::_getRevPkgDeps方法的具体用法?PHP PEAR_Common::_getRevPkgDeps怎么用?PHP PEAR_Common::_getRevPkgDeps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Common
的用法示例。
在下文中一共展示了PEAR_Common::_getRevPkgDeps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _sortPkgDepsRev
/**
* Compare two package's package.xml, and sort
* so that dependencies are uninstalled last
*
* This is a crude compare, real dependency checking is done on uninstall.
* The only purpose this serves is to make the command-line
* order-independent (you can list a dependency first, and
* uninstallation occurs in the order required)
* @access private
*/
function _sortPkgDepsRev($p1, $p2)
{
$p1name = $p1['info']['package'];
$p2name = $p2['info']['package'];
$p1deps = PEAR_Common::_getRevPkgDeps($p1);
$p2deps = PEAR_Common::_getRevPkgDeps($p2);
if (!count($p1deps) && !count($p2deps)) {
return 0;
// order makes no difference
}
if (!count($p1deps)) {
return 1;
// package 2 has dependencies, package 1 doesn't
}
if (!count($p2deps)) {
return -1;
// package 2 has dependencies, package 1 doesn't
}
// both have dependencies
if (in_array($p1name, $p2deps)) {
return 1;
// put package 1 last
}
if (in_array($p2name, $p1deps)) {
return -1;
// put package 2 last
}
// doesn't really matter if neither depends on the other
return 0;
}