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


PHP PEAR_Downloader_Package::_fromFile方法代码示例

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


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

示例1: mergeDependencies

 /**
  * @static
  */
 function mergeDependencies(&$params)
 {
     $bundles = $newparams = array();
     foreach ($params as $i => $param) {
         if (!$param->isBundle()) {
             continue;
         }
         $bundles[] = $i;
         $pf =& $param->getPackageFile();
         $newdeps = array();
         $contents = $pf->getBundledPackages();
         if (!is_array($contents)) {
             $contents = array($contents);
         }
         foreach ($contents as $file) {
             $filecontents = $pf->getFileContents($file);
             $dl =& $param->getDownloader();
             $options = $dl->getOptions();
             if (PEAR::isError($dir = $dl->getDownloadDir())) {
                 return $dir;
             }
             $fp = @fopen($dir . DIRECTORY_SEPARATOR . $file, 'wb');
             if (!$fp) {
                 continue;
             }
             fwrite($fp, $filecontents, strlen($filecontents));
             fclose($fp);
             if ($s = $params[$i]->explicitState()) {
                 $obj->setExplicitState($s);
             }
             $obj = new PEAR_Downloader_Package($params[$i]->getDownloader());
             PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
             if (PEAR::isError($dir = $dl->getDownloadDir())) {
                 PEAR::popErrorHandling();
                 return $dir;
             }
             $e = $obj->_fromFile($a = $dir . DIRECTORY_SEPARATOR . $file);
             PEAR::popErrorHandling();
             if (PEAR::isError($e)) {
                 if (!isset($options['soft'])) {
                     $dl->log(0, $e->getMessage());
                 }
                 continue;
             }
             $j =& $obj;
             if (!PEAR_Downloader_Package::willDownload($j, array_merge($params, $newparams)) && !$param->isInstalled($j)) {
                 $newparams[] =& $j;
             }
         }
     }
     foreach ($bundles as $i) {
         unset($params[$i]);
         // remove bundles - only their contents matter for installation
     }
     PEAR_Downloader_Package::removeDuplicates($params);
     // strip any unset indices
     if (count($newparams)) {
         // add in bundled packages for install
         foreach ($newparams as $i => $unused) {
             $params[] =& $newparams[$i];
         }
         $newparams = array();
     }
     foreach ($params as $i => $param) {
         $newdeps = array();
         foreach ($param->_downloadDeps as $dep) {
             $merge = array_merge($params, $newparams);
             if (!PEAR_Downloader_Package::willDownload($dep, $merge) && !$param->isInstalled($dep)) {
                 $newdeps[] = $dep;
             } else {
                 //var_dump($dep);
                 // detect versioning conflicts here
             }
         }
         // convert the dependencies into PEAR_Downloader_Package objects for the next time around
         $params[$i]->_downloadDeps = array();
         foreach ($newdeps as $dep) {
             $obj = new PEAR_Downloader_Package($params[$i]->getDownloader());
             if ($s = $params[$i]->explicitState()) {
                 $obj->setExplicitState($s);
             }
             PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
             $e = $obj->fromDepURL($dep);
             PEAR::popErrorHandling();
             if (PEAR::isError($e)) {
                 if (!isset($options['soft'])) {
                     $obj->_downloader->log(0, $e->getMessage());
                 }
                 continue;
             }
             $e = $obj->detectDependencies($params);
             if (PEAR::isError($e)) {
                 if (!isset($options['soft'])) {
                     $obj->_downloader->log(0, $e->getMessage());
                 }
             }
             $j =& $obj;
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Package.php


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