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


PHP PEAR_PackageFile_v2::setRawCompatible方法代码示例

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


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

示例1: isset

 /**
  * @param array output of {@link parsePackageName()}
  * @access private
  */
 function _getPackageDownloadUrl($parr)
 {
     $curchannel = $this->config->get('default_channel');
     $this->configSet('default_channel', $parr['channel']);
     // getDownloadURL returns an array.  On error, it only contains information
     // on the latest release as array(version, info).  On success it contains
     // array(version, info, download url string)
     $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
     if (!$this->_registry->channelExists($parr['channel'])) {
         do {
             if ($this->config->get('auto_discover') && $this->discover($parr['channel'])) {
                 break;
             }
             $this->configSet('default_channel', $curchannel);
             return PEAR::raiseError('Unknown remote channel: ' . $parr['channel']);
         } while (false);
     }
     $chan =& $this->_registry->getChannel($parr['channel']);
     if (PEAR::isError($chan)) {
         return $chan;
     }
     PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
     $version = $this->_registry->packageInfo($parr['package'], 'version', $parr['channel']);
     $stability = $this->_registry->packageInfo($parr['package'], 'stability', $parr['channel']);
     // package is installed - use the installed release stability level
     if (!isset($parr['state']) && $stability !== null) {
         $state = $stability['release'];
     }
     PEAR::staticPopErrorHandling();
     $base2 = false;
     $preferred_mirror = $this->config->get('preferred_mirror');
     if (!$chan->supportsREST($preferred_mirror) || !($base2 = $chan->getBaseURL('REST1.3', $preferred_mirror)) && !($base = $chan->getBaseURL('REST1.0', $preferred_mirror))) {
         return $this->raiseError($parr['channel'] . ' is using a unsupported protocol - This should never happen.');
     }
     if ($base2) {
         $rest =& $this->config->getREST('1.3', $this->_options);
         $base = $base2;
     } else {
         $rest =& $this->config->getREST('1.0', $this->_options);
     }
     $downloadVersion = false;
     if (!isset($parr['version']) && !isset($parr['state']) && $version && !PEAR::isError($version) && !isset($this->_options['downloadonly'])) {
         $downloadVersion = $version;
     }
     $url = $rest->getDownloadURL($base, $parr, $state, $downloadVersion, $chan->getName());
     if (PEAR::isError($url)) {
         $this->configSet('default_channel', $curchannel);
         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($this->_options['force']) && !isset($this->_options['downloadonly']) && $version && !PEAR::isError($version) && !isset($parr['group'])) {
         if (version_compare($version, $url['version'], '=')) {
             return PEAR::raiseError($this->_registry->parsedPackageNameToString($parr, true) . ' is already installed and is the same as the ' . 'released version ' . $url['version'], -976);
         }
         if (version_compare($version, $url['version'], '>')) {
             return PEAR::raiseError($this->_registry->parsedPackageNameToString($parr, true) . ' is already installed and is newer than detected ' . 'released version ' . $url['version'], -976);
         }
     }
     if (isset($url['info']['required']) || $url['compatible']) {
         require_once 'PEAR/PackageFile/v2.php';
         $pf = new PEAR_PackageFile_v2();
         $pf->setRawChannel($parr['channel']);
         if ($url['compatible']) {
             $pf->setRawCompatible($url['compatible']);
         }
     } else {
         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']);
     }
     $pf->setRawState($url['stability']);
     $url['info'] =& $pf;
     if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) {
         $ext = '.tar';
     } else {
         $ext = '.tgz';
     }
     if (is_array($url) && isset($url['url'])) {
         $url['url'] .= $ext;
     }
     return $url;
 }
开发者ID:shen0834,项目名称:util,代码行数:100,代码来源:Downloader.php

示例2: isset

 /**
  * @param array output of {@link parsePackageName()}
  * @access private
  */
 function _getPackageDownloadUrl($parr)
 {
     $curchannel = $this->config->get('default_channel');
     $this->configSet('default_channel', $parr['channel']);
     // getDownloadURL returns an array.  On error, it only contains information
     // on the latest release as array(version, info).  On success it contains
     // array(version, info, download url string)
     $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
     if (!$this->_registry->channelExists($parr['channel'])) {
         do {
             if ($this->config->get('auto_discover')) {
                 if ($this->discover($parr['channel'])) {
                     break;
                 }
             }
             $this->configSet('default_channel', $curchannel);
             return PEAR::raiseError('Unknown remote channel: ' . $remotechannel);
         } while (false);
     }
     $chan =& $this->_registry->getChannel($parr['channel']);
     if (PEAR::isError($chan)) {
         return $chan;
     }
     $version = $this->_registry->packageInfo($parr['package'], 'version', $parr['channel']);
     if ($chan->supportsREST($this->config->get('preferred_mirror')) && ($base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror')))) {
         $rest =& $this->config->getREST('1.0', $this->_options);
         if (!isset($parr['version']) && !isset($parr['state']) && $version && !isset($this->_options['downloadonly'])) {
             $url = $rest->getDownloadURL($base, $parr, $state, $version);
         } else {
             $url = $rest->getDownloadURL($base, $parr, $state, false);
         }
         if (PEAR::isError($url)) {
             $this->configSet('default_channel', $curchannel);
             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']) || $url['compatible']) {
             require_once 'PEAR/PackageFile/v2.php';
             $pf = new PEAR_PackageFile_v2();
             $pf->setRawChannel($parr['channel']);
             if ($url['compatible']) {
                 $pf->setRawCompatible($url['compatible']);
             }
         } else {
             require_once 'PEAR/PackageFile/v1.php';
             $pf = new PEAR_PackageFile_v1();
         }
         $pf->setRawPackage($url['package']);
         $pf->setDeps($url['info']);
         $pf->setRawState($url['stability']);
         $url['info'] =& $pf;
         if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) {
             $ext = '.tar';
         } else {
             $ext = '.tgz';
         }
         if (is_array($url)) {
             if (isset($url['url'])) {
                 $url['url'] .= $ext;
             }
         }
         return $url;
     } elseif ($chan->supports('xmlrpc', 'package.getDownloadURL', false, '1.1')) {
         // don't install with the old version information unless we're doing a plain
         // vanilla simple installation.  If the user says to install a particular
         // version or state, ignore the current installed version
         if (!isset($parr['version']) && !isset($parr['state']) && $version && !isset($this->_options['downloadonly'])) {
             $url = $this->_remote->call('package.getDownloadURL', $parr, $state, $version);
         } else {
             $url = $this->_remote->call('package.getDownloadURL', $parr, $state);
         }
     } else {
         $url = $this->_remote->call('package.getDownloadURL', $parr, $state);
     }
     if (PEAR::isError($url)) {
         return $url;
     }
     if ($parr['channel'] != $curchannel) {
         $this->configSet('default_channel', $curchannel);
     }
     if (isset($url['__PEAR_ERROR_CLASS__'])) {
         return PEAR::raiseError($url['message']);
     }
     if (!is_array($url)) {
         return $url;
     }
//.........这里部分代码省略.........
开发者ID:soar-team,项目名称:kloxo,代码行数:101,代码来源:Downloader.php


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