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


PHP PEAR_Downloader::_getDepPackageDownloadUrl方法代码示例

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


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

示例1: array

 function _detect1($deps, $pname, $options, $params)
 {
     $this->_downloadDeps = array();
     $skipnames = array();
     foreach ($deps as $dep) {
         $nodownload = false;
         if ($dep['type'] == 'pkg') {
             $dep['channel'] = 'pear.php.net';
             $dep['package'] = $dep['name'];
             switch ($dep['rel']) {
                 case 'not':
                     continue 2;
                 case 'ge':
                 case 'eq':
                 case 'gt':
                 case 'has':
                     $group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
                     if (PEAR_Downloader_Package::willDownload($dep, $params)) {
                         $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed');
                         continue 2;
                     }
                     $fakedp = new PEAR_PackageFile_v1();
                     $fakedp->setPackage($dep['name']);
                     // skip internet check if we are not upgrading (bug #5810)
                     if (!isset($options['upgrade']) && $this->isInstalled($fakedp, $dep['rel'])) {
                         $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", is already installed');
                         continue 2;
                     }
             }
             PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
             if ($this->_explicitState) {
                 $pname['state'] = $this->_explicitState;
             }
             $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname);
             $chan = 'pear.php.net';
             if (PEAR::isError($url)) {
                 // check to see if this is a pecl package that has jumped
                 // from pear.php.net to pecl.php.net channel
                 if (!class_exists('PEAR_Dependency2')) {
                     require_once 'PEAR/Dependency2.php';
                 }
                 $newdep = PEAR_Dependency2::normalizeDep($dep);
                 $newdep = $newdep[0];
                 $newdep['channel'] = 'pecl.php.net';
                 $chan = 'pecl.php.net';
                 $url = $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname);
                 $obj =& $this->_registry->getPackage($dep['name']);
                 if (PEAR::isError($url)) {
                     PEAR::popErrorHandling();
                     if ($obj !== null && $this->isInstalled($obj, $dep['rel'])) {
                         $group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
                         $dep['package'] = $dep['name'];
                         if (!isset($options['soft'])) {
                             $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", already installed as version ' . $obj->getVersion());
                         }
                         if (@$skipnames[count($skipnames) - 1] == $this->_registry->parsedPackageNameToString($dep, true)) {
                             array_pop($skipnames);
                         }
                         continue;
                     } else {
                         if (isset($dep['optional']) && $dep['optional'] == 'yes') {
                             $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", no releases exist');
                             continue;
                         } else {
                             return $url;
                         }
                     }
                 }
             }
             PEAR::popErrorHandling();
             if (!isset($options['alldeps'])) {
                 if (isset($dep['optional']) && $dep['optional'] == 'yes') {
                     if (!isset($options['soft'])) {
                         $this->_downloader->log(3, 'Notice: package "' . $this->getShortName() . '" optional dependency "' . $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded');
                     }
                     $skipnames[] = $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true);
                     $nodownload = true;
                 }
             }
             if (!isset($options['alldeps']) && !isset($options['onlyreqdeps'])) {
                 if (!isset($dep['optional']) || $dep['optional'] == 'no') {
                     if (!isset($options['soft'])) {
                         $this->_downloader->log(3, 'Notice: package "' . $this->getShortName() . '" required dependency "' . $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded');
                     }
                     $skipnames[] = $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true);
                     $nodownload = true;
                 }
             }
             // check to see if a dep is already installed
             // do not try to move this before getDepPackageDownloadURL
             // we can't determine whether upgrade is necessary until we know what
             // version would be downloaded
             if (!isset($options['force']) && $this->isInstalled($url, $dep['rel'])) {
                 $group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
                 $dep['package'] = $dep['name'];
                 if (isset($newdep)) {
                     $version = $this->_registry->packageInfo($newdep['name'], 'version', $newdep['channel']);
                 } else {
                     $version = $this->_registry->packageInfo($dep['name'], 'version');
                 }
//.........这里部分代码省略.........
开发者ID:hbustun,项目名称:agilebill,代码行数:101,代码来源:Package.php

示例2: array

 function _detect1($deps, $pname, $options, $params)
 {
     $skipnames = array();
     foreach ($deps as $dep) {
         $nodownload = false;
         if ($dep['type'] == 'pkg') {
             $dep['channel'] = 'pear.php.net';
             $dep['package'] = $dep['name'];
             switch ($dep['rel']) {
                 case 'not':
                     continue 2;
                 case 'ge':
                 case 'eq':
                 case 'gt':
                 case 'has':
                     if (PEAR_Downloader_Package::willDownload($dep, $params)) {
                         $group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
                         $this->_downloader->log(2, 'Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed');
                         continue 2;
                     }
             }
             if (!isset($options['alldeps'])) {
                 if (isset($dep['optional']) && $dep['optional'] == 'yes') {
                     if (!isset($options['soft'])) {
                         $this->_downloader->log(3, 'Notice: package "' . $this->_registry->parsedPackageNameToString(array('channel' => 'pear.php.net', 'package' => $this->getPackage()), true) . '" optional dependency "' . $this->_registry->parsedPackageNameToString(array('channel' => 'pear.php.net', 'package' => $dep['name']), true) . '" will not be automatically downloaded');
                     }
                     $skipnames[] = $this->_registry->parsedPackageNameToString(array('channel' => 'pear.php.net', 'package' => $dep['name']), true);
                     $nodownload = true;
                 }
             }
             if (!isset($options['alldeps']) && !isset($options['onlyreqdeps'])) {
                 if (!isset($dep['optional']) || $dep['optional'] == 'no') {
                     if (!isset($options['soft'])) {
                         $this->_downloader->log(3, 'Notice: package "' . $this->_registry->parsedPackageNameToString(array('channel' => 'pear.php.net', 'package' => $this->getPackage()), true) . '" required dependency "' . $this->_registry->parsedPackageNameToString(array('channel' => 'pear.php.net', 'package' => $dep['name']), true) . '" will not be automatically downloaded');
                     }
                     $skipnames[] = $this->_registry->parsedPackageNameToString(array('channel' => 'pear.php.net', 'package' => $dep['name']), true);
                     $nodownload = true;
                 }
             }
             PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
             if ($this->_explicitState) {
                 $pname['state'] = $this->_explicitState;
             }
             $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname);
             if (PEAR::isError($url)) {
                 PEAR::popErrorHandling();
                 return $url;
             }
             PEAR::popErrorHandling();
             // check to see if a dep is already installed
             // do not try to move this before getDepPackageDownloadURL
             // we can't determine whether upgrade is necessary until we know what
             // version would be downloaded
             if (!isset($options['force']) && $this->isInstalled($url, $dep['rel'])) {
                 $group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
                 $dep['package'] = $dep['name'];
                 $version = $this->_registry->packageInfo($dep['name'], 'version');
                 $dep['version'] = $url['version'];
                 if (!isset($options['soft'])) {
                     $this->_downloader->log(3, 'Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", already installed as version ' . $version);
                 }
                 if (@$skipnames[count($skipnames) - 1] == $this->_registry->parsedPackageNameToString(array('channel' => 'pear.php.net', 'package' => $dep['name']), true)) {
                     array_pop($skipnames);
                 }
                 continue;
             }
             if ($nodownload) {
                 continue;
             }
             PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
             $dep['package'] = $dep['name'];
             $ret = $this->_analyzeDownloadURL($url, 'dependency', $dep, $params);
             PEAR::popErrorHandling();
             if (PEAR::isError($ret)) {
                 if (!isset($options['soft'])) {
                     $this->_downloader->log(0, $ret->getMessage());
                 }
                 continue;
             }
             $this->_downloadDeps[] = $ret;
         }
     }
     if (count($skipnames)) {
         if (!isset($options['soft'])) {
             $this->_downloader->log(1, 'Did not download dependencies: ' . implode(', ', $skipnames) . ', use --alldeps or --onlyreqdeps to download automatically');
         }
     }
 }
开发者ID:alex-k,项目名称:velotur,代码行数:88,代码来源:Package.php


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