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


PHP PEAR_PackageFile_v1::setCompatible方法代码示例

本文整理汇总了PHP中PEAR_PackageFile_v1::setCompatible方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile_v1::setCompatible方法的具体用法?PHP PEAR_PackageFile_v1::setCompatible怎么用?PHP PEAR_PackageFile_v1::setCompatible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PEAR_PackageFile_v1的用法示例。


在下文中一共展示了PEAR_PackageFile_v1::setCompatible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isset

 /**
  * @param array dependency array
  * @access private
  */
 function _getDepPackageDownloadUrl($dep, $parr)
 {
     $xsdversion = isset($dep['rel']) ? '1.0' : '2.0';
     $curchannel = $this->config->get('default_channel');
     if (isset($dep['uri'])) {
         $xsdversion = '2.0';
         $chan =& $this->_registry->getChannel('__uri');
         if (PEAR::isError($chan)) {
             return $chan;
         }
         $version = $this->_registry->packageInfo($dep['name'], 'version', '__uri');
         $this->configSet('default_channel', '__uri');
     } else {
         if (isset($dep['channel'])) {
             $remotechannel = $dep['channel'];
         } else {
             $remotechannel = 'pear.php.net';
         }
         if (!$this->_registry->channelExists($remotechannel)) {
             do {
                 if ($this->config->get('auto_discover')) {
                     if ($this->discover($remotechannel)) {
                         break;
                     }
                 }
                 return PEAR::raiseError('Unknown remote channel: ' . $remotechannel);
             } while (false);
         }
         $chan =& $this->_registry->getChannel($remotechannel);
         if (PEAR::isError($chan)) {
             return $chan;
         }
         $version = $this->_registry->packageInfo($dep['name'], 'version', $remotechannel);
         $this->configSet('default_channel', $remotechannel);
     }
     $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
     if (isset($parr['state']) && isset($parr['version'])) {
         unset($parr['state']);
     }
     if (isset($dep['uri'])) {
         $info =& $this->newDownloaderPackage($this);
         PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
         $err = $info->initialize($dep);
         PEAR::staticPopErrorHandling();
         if (!$err) {
             // skip parameters that were missed by preferred_state
             return PEAR::raiseError('Cannot initialize dependency');
         }
         if (PEAR::isError($err)) {
             if (!isset($this->_options['soft'])) {
                 $this->log(0, $err->getMessage());
             }
             if (is_object($info)) {
                 $param = $info->getChannel() . '/' . $info->getPackage();
             }
             return PEAR::raiseError('Package "' . $param . '" is not valid');
         }
         return $info;
     } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) && (($base2 = $chan->getBaseURL('REST1.3', $this->config->get('preferred_mirror'))) || ($base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))))) {
         if ($base2) {
             $base = $base2;
             $rest =& $this->config->getREST('1.3', $this->_options);
         } else {
             $rest =& $this->config->getREST('1.0', $this->_options);
         }
         $url = $rest->getDepDownloadURL($base, $xsdversion, $dep, $parr, $state, $version, $chan->getName());
         if (PEAR::isError($url)) {
             return $url;
         }
         if ($parr['channel'] != $curchannel) {
             $this->configSet('default_channel', $curchannel);
         }
         if (!is_array($url)) {
             return $url;
         }
         $url['raw'] = false;
         // no checking is necessary for REST
         if (!is_array($url['info'])) {
             return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' . 'this should never happen');
         }
         if (isset($url['info']['required'])) {
             if (!class_exists('PEAR_PackageFile_v2')) {
                 require_once 'PEAR/PackageFile/v2.php';
             }
             $pf = new PEAR_PackageFile_v2();
             $pf->setRawChannel($remotechannel);
         } else {
             if (!class_exists('PEAR_PackageFile_v1')) {
                 require_once 'PEAR/PackageFile/v1.php';
             }
             $pf = new PEAR_PackageFile_v1();
         }
         $pf->setRawPackage($url['package']);
         $pf->setDeps($url['info']);
         if ($url['compatible']) {
             $pf->setCompatible($url['compatible']);
//.........这里部分代码省略.........
开发者ID:shen0834,项目名称:util,代码行数:101,代码来源:Downloader.php


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