當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PEAR_Downloader_Package::fromDepURL方法代碼示例

本文整理匯總了PHP中PEAR_Downloader_Package::fromDepURL方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_Downloader_Package::fromDepURL方法的具體用法?PHP PEAR_Downloader_Package::fromDepURL怎麽用?PHP PEAR_Downloader_Package::fromDepURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PEAR_Downloader_Package的用法示例。


在下文中一共展示了PEAR_Downloader_Package::fromDepURL方法的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::fromDepURL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。