當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。