本文整理汇总了PHP中PEAR_Registry::packageinfo方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Registry::packageinfo方法的具体用法?PHP PEAR_Registry::packageinfo怎么用?PHP PEAR_Registry::packageinfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Registry
的用法示例。
在下文中一共展示了PEAR_Registry::packageinfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function _validatePackageUninstall($dep, $required, $dl)
{
$depname = $this->_registry->parsedPackageNameToString($dep, true);
$version = $this->_registry->packageinfo($dep['package'], 'version', $dep['channel']);
if (!$version) {
return true;
}
$extra = $this->_getExtraString($dep);
if (isset($dep['exclude'])) {
if (!is_array($dep['exclude'])) {
$dep['exclude'] = array($dep['exclude']);
}
}
if (isset($dep['conflicts'])) {
return true;
// uninstall OK - these packages conflict (probably installed with --force)
}
if (!isset($dep['min']) && !isset($dep['max'])) {
if ($required) {
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError('"' . $depname . '" is required by ' . 'installed package %s' . $extra);
} else {
return $this->warning('warning: "' . $depname . '" is required by ' . 'installed package %s' . $extra);
}
} else {
return $this->warning('"' . $depname . '" can be optionally used by ' . 'installed package %s' . $extra);
}
}
$fail = false;
if (isset($dep['min'])) {
if (version_compare($version, $dep['min'], '>=')) {
$fail = true;
}
}
if (isset($dep['max'])) {
if (version_compare($version, $dep['max'], '<=')) {
$fail = true;
}
}
// we re-use this variable, preserve the original value
$saverequired = $required;
if ($required) {
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError($depname . $extra . ' is required by installed package' . ' "%s"');
} else {
return $this->raiseError('warning: ' . $depname . $extra . ' is required by installed package "%s"');
}
} else {
return $this->warning($depname . $extra . ' can be optionally used by installed package' . ' "%s"');
}
return true;
}
示例2: foreach
function _validatePackageUninstall($dep, $required, $params, &$dl)
{
$dep['package'] = $dep['name'];
$depname = $this->_registry->parsedPackageNameToString($dep, true);
$found = false;
foreach ($params as $param) {
if ($param->isEqual($this->_currentPackage)) {
$found = true;
break;
}
}
$version = $this->_registry->packageinfo($dep['name'], 'version', $dep['channel']);
if (!$version) {
return true;
}
$extra = $this->_getExtraString($dep);
if (isset($dep['exclude'])) {
if (!is_array($dep['exclude'])) {
$dep['exclude'] = array($dep['exclude']);
}
}
if (isset($dep['conflicts'])) {
return true;
// uninstall OK - these packages conflict (probably installed with --force)
}
if (!isset($dep['min']) && !isset($dep['max'])) {
if ($required) {
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError('%s' . $extra . ' is required by installed package "' . $depname . '"');
} else {
return $this->warning('warning: %s' . $extra . ' is required by installed package "' . $depname . '"');
}
} else {
return $this->warning('%s' . $extra . ' can be optionally used by installed package "' . $depname . '"');
}
}
$fail = false;
if (isset($dep['min'])) {
if (version_compare($version, $dep['min'], '>=')) {
$fail = true;
}
}
if (isset($dep['max'])) {
if (version_compare($version, $dep['max'], '<=')) {
$fail = true;
}
}
if ($fail) {
if ($found) {
if (!isset($dl->___checked[$this->_currentPackage['channel']][$this->_currentPackage['package']])) {
$dl->___checked[$this->_currentPackage['channel']][$this->_currentPackage['package']] = true;
$deps = $this->_dependencydb->getDependentPackageDependencies($this->_currentPackage);
if ($deps) {
foreach ($deps as $channel => $info) {
foreach ($info as $package => $ds) {
foreach ($ds as $d) {
$d['dep']['package'] = $d['dep']['name'];
$checker =& new PEAR_Dependency2($this->_config, $this->_options, array('channel' => $channel, 'package' => $package), $this->_state);
$dep = $d['dep'];
$required = $d['type'] == 'required';
$ret = $checker->_validatePackageUninstall($dep, $required, $params, $dl);
if (PEAR::isError($ret)) {
$fail = true;
break 3;
}
}
}
$fail = false;
}
}
} else {
return true;
}
}
if (!$fail) {
return true;
}
if ($required) {
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError($depname . $extra . ' is required by installed package' . ' "%s"');
} else {
return $this->warning('warning: ' . $depname . $extra . ' is required by installed package "%s"');
}
} else {
return $this->warning($depname . $extra . ' can be optionally used by installed package' . ' "%s"');
}
}
return true;
}