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


PHP PEAR_Downloader::popErrorHandling方法代碼示例

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


在下文中一共展示了PEAR_Downloader::popErrorHandling方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

 function _fromUrl($param, $saveparam = '')
 {
     if (!is_array($param) && preg_match('#^(http|ftp)://#', $param)) {
         $options = $this->_downloader->getOptions();
         $this->_type = 'url';
         $callback = $this->_downloader->ui ? array(&$this->_downloader, '_downloadCallback') : null;
         $this->_downloader->pushErrorHandling(PEAR_ERROR_RETURN);
         $file = $this->_downloader->downloadHttp($param, $this->_downloader->ui, $this->_downloader->getDownloadDir(), $callback);
         $this->_downloader->popErrorHandling();
         if (PEAR::isError($file)) {
             if (!empty($saveparam)) {
                 $saveparam = ", cannot download \"{$saveparam}\"";
             }
             $err = PEAR::raiseError('Could not download from "' . $param . '"' . $saveparam);
             return $err;
         }
         if ($this->_rawpackagefile) {
             require_once 'Archive/Tar.php';
             $tar =& new Archive_Tar($file);
             $packagexml = $tar->extractInString('package2.xml');
             if (!$packagexml) {
                 $packagexml = $tar->extractInString('package.xml');
             }
             if (str_replace(array("\n", "\r"), array('', ''), $packagexml) != str_replace(array("\n", "\r"), array('', ''), $this->_rawpackagefile)) {
                 if ($this->getChannel() == 'pear.php.net') {
                     // be more lax for the existing PEAR packages that have not-ok
                     // characters in their package.xml
                     $this->_downloader->log(0, 'CRITICAL WARNING: The "' . $this->getPackage() . '" package has invalid characters in its ' . 'package.xml.  The next version of PEAR may not be able to install ' . 'this package for security reasons.  Please open a bug report at ' . 'http://pear.php.net/package/' . $this->getPackage() . '/bugs');
                 } else {
                     return PEAR::raiseError('CRITICAL ERROR: package.xml downloaded does ' . 'not match value returned from xml-rpc');
                 }
             }
         }
         // whew, download worked!
         if (isset($options['downloadonly'])) {
             $pkg =& $this->getPackagefileObject($this->_config, $this->_downloader->debug);
         } else {
             $pkg =& $this->getPackagefileObject($this->_config, $this->_downloader->debug, $this->_downloader->getDownloadDir());
         }
         PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
         $pf =& $pkg->fromAnyFile($file, PEAR_VALIDATE_INSTALLING);
         PEAR::popErrorHandling();
         if (PEAR::isError($pf)) {
             if (is_array($pf->getUserInfo())) {
                 foreach ($pf->getUserInfo() as $err) {
                     if (is_array($err)) {
                         $err = $err['message'];
                     }
                     if (!isset($options['soft'])) {
                         $this->_downloader->log(0, "Validation Error: {$err}");
                     }
                 }
             }
             if (!isset($options['soft'])) {
                 $this->_downloader->log(0, $pf->getMessage());
             }
             $err = PEAR::raiseError('Download of "' . ($saveparam ? $saveparam : $param) . '" succeeded, but it is not a valid package archive');
             $this->_valid = false;
             return $err;
         }
         $this->_packagefile =& $pf;
         $this->setGroup('default');
         // install the default dependency group
         return $this->_valid = true;
     }
     return $this->_valid = false;
 }
開發者ID:hbustun,項目名稱:agilebill,代碼行數:67,代碼來源:Package.php


注:本文中的PEAR_Downloader::popErrorHandling方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。