本文整理汇总了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;
}