当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_Registry::packageinfo方法代码示例

本文整理汇总了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;
 }
开发者ID:laiello,项目名称:coopcrucial,代码行数:52,代码来源:Dependency2.php

示例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;
 }
开发者ID:BackupTheBerlios,项目名称:delphinus-svn,代码行数:89,代码来源:Dependency2.php


注:本文中的PEAR_Registry::packageinfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。