本文整理汇总了PHP中PEAR_Registry::parsedPackageNameToString方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Registry::parsedPackageNameToString方法的具体用法?PHP PEAR_Registry::parsedPackageNameToString怎么用?PHP PEAR_Registry::parsedPackageNameToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Registry
的用法示例。
在下文中一共展示了PEAR_Registry::parsedPackageNameToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
/**
* @param array output of package.getDownloadURL
* @param string|array|object information for detecting packages to be downloaded, and
* for errors
* @param array name information of the package
* @param array|null packages to be downloaded
* @access private
*/
function _analyzeDownloadURL($info, $param, $pname, $params = null)
{
if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) {
return false;
}
if (!$info) {
if (!is_string($param)) {
$saveparam = ", cannot download \"{$param}\"";
} else {
$saveparam = '';
}
// no releases exist
return PEAR::raiseError('No releases for package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam);
}
if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) {
$err = false;
if ($pname['channel'] == 'pear.php.net') {
if ($info['info']->getChannel() != 'pecl.php.net') {
$err = true;
}
} else {
$err = true;
}
if ($err) {
return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] . '" retrieved another channel\'s name for download! ("' . $info['info']->getChannel() . '")');
}
}
if (!isset($info['url'])) {
// releases exist, but we failed to get any
if (isset($this->_downloader->_options['force'])) {
if (isset($pname['version'])) {
$vs = ', version "' . $pname['version'] . '"';
} elseif (isset($pname['state'])) {
$vs = ', stability "' . $pname['state'] . '"';
} else {
$vs = ' within preferred state ' . $this->_config->get('preferred_state') . '"';
}
if (!isset($options['soft'])) {
$this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . $vs . ', will instead download version ' . $info['version'] . ', stability "' . $info['info']->getState() . '"');
}
// download the latest release
return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
} else {
// construct helpful error message
if (isset($pname['version'])) {
$vs = ', version "' . $pname['version'] . '"';
} elseif (isset($pname['state'])) {
$vs = ', stability "' . $pname['state'] . '"';
} else {
$vs = ' within preferred state ' . $this->_downloader->config->get('preferred_state') . '"';
}
$err = PEAR::raiseError('Failed to download ' . $this->_registry->parsedPackageNameToString(array('channel' => $pname['channel'], 'package' => $pname['package']), true) . $vs . ', latest release is version ' . $info['version'] . ', stability "' . $info['info']->getState() . '", use "' . $this->_registry->parsedPackageNameToString(array('channel' => $pname['channel'], 'package' => $pname['package'], 'version' => $info['version'])) . '" to install');
return $err;
}
}
return $info;
}
示例2: installBinary
/**
* Installation of source package has failed, attempt to download and install the
* binary version of this package.
* @param PEAR_Installer
*/
function installBinary(&$installer)
{
if ($this->getPackageType() == 'extsrc') {
if (!is_array($installer->getInstallPackages())) {
return false;
}
foreach ($installer->getInstallPackages() as $p) {
if ($p->isExtension($this->_packageInfo['providesextension'])) {
if ($p->getPackageType() != 'extsrc') {
return false;
// the user probably downloaded it separately
}
}
}
if (isset($this->_packageInfo['extsrcrelease']['binarypackage'])) {
$installer->log(0, 'Attempting to download binary version of extension "' . $this->_packageInfo['providesextension'] . '"');
$params = $this->_packageInfo['extsrcrelease']['binarypackage'];
if (!is_array($params) || !isset($params[0])) {
$params = array($params);
}
if (isset($this->_packageInfo['channel'])) {
foreach ($params as $i => $param) {
$params[$i] = array('channel' => $this->_packageInfo['channel'], 'package' => $param);
}
}
$dl =& $this->getPEARDownloader($installer->ui, $installer->getOptions(), $installer->config);
$verbose = $dl->config->get('verbose');
$dl->config->set('verbose', -1);
foreach ($params as $param) {
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$ret = $dl->download(array($param));
PEAR::popErrorHandling();
if (is_array($ret) && count($ret)) {
break;
}
}
$dl->config->set('verbose', $verbose);
if (is_array($ret)) {
if (count($ret) == 1) {
$pf = $ret[0]->getPackageFile();
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$ret = $installer->install($ret[0]);
PEAR::popErrorHandling();
if (is_array($ret)) {
$installer->log(0, 'Download and install of binary extension "' . $this->_registry->parsedPackageNameToString(array('channel' => $pf->getChannel(), 'package' => $pf->getPackage()), true) . '" successful');
return $ret;
}
$installer->log(0, 'Download and install of binary extension "' . $this->_registry->parsedPackageNameToString(array('channel' => $pf->getChannel(), 'package' => $pf->getPackage()), true) . '" failed');
}
}
}
}
return false;
}
示例3: foreach
/**
* Set up the dependency for installation parsing
*
* @param array $t dependency information
* @param PEAR_Registry $reg
* @param array $deplinks list of dependency links already established
* @param array $nodes all existing package nodes
* @param string $package parent package name
* @access private
*/
function _setupGraph($t, $reg, &$deplinks, &$nodes, $package)
{
foreach ($t as $dep) {
$depchannel = !isset($dep['channel']) ? '__uri' : $dep['channel'];
$dname = $reg->parsedPackageNameToString(array('channel' => $depchannel, 'package' => strtolower($dep['name'])));
if (isset($nodes[$dname])) {
if (!isset($deplinks[$dname])) {
$deplinks[$dname] = array();
}
$deplinks[$dname][$package] = 1;
}
}
}
示例4: array
//.........这里部分代码省略.........
}
$curchannel =& $this->_registry->getChannel($params[$i]->getChannel());
if (PEAR::isError($curchannel)) {
PEAR::staticPopErrorHandling();
return $this->raiseError($curchannel);
}
$a = $this->downloadHttp('http://' . $params[$i]->getChannel() . '/channel.xml', $this->ui, System::mktemp(array('-d')), null, $curchannel->lastModified());
PEAR::staticPopErrorHandling();
if (PEAR::isError($a) || !$a) {
continue;
}
$this->log(0, 'WARNING: channel "' . $params[$i]->getChannel() . '" has ' . 'updated its protocols, use "channel-update ' . $params[$i]->getChannel() . '" to update');
}
if ($params[$i] && !isset($this->_options['downloadonly'])) {
if (isset($this->_options['packagingroot'])) {
$checkdir = $this->_prependPath($this->config->get('php_dir', null, $params[$i]->getChannel()), $this->_options['packagingroot']);
} else {
$checkdir = $this->config->get('php_dir', null, $params[$i]->getChannel());
}
while ($checkdir && $checkdir != '/' && !file_exists($checkdir)) {
$checkdir = dirname($checkdir);
}
if ($checkdir == '.') {
$checkdir = '/';
}
if (!@is_writeable($checkdir)) {
return PEAR::raiseError('Cannot install, php_dir for channel "' . $params[$i]->getChannel() . '" is not writeable by the current user');
}
}
}
}
unset($channelschecked);
PEAR_Downloader_Package::removeDuplicates($params);
if (!count($params)) {
$a = array();
return $a;
}
if (!isset($this->_options['nodeps']) && !isset($this->_options['offline'])) {
$reverify = true;
while ($reverify) {
$reverify = false;
foreach ($params as $i => $param) {
$ret = $params[$i]->detectDependencies($params);
if (PEAR::isError($ret)) {
$reverify = true;
$params[$i] = false;
PEAR_Downloader_Package::removeDuplicates($params);
if (!isset($this->_options['soft'])) {
$this->log(0, $ret->getMessage());
}
continue 2;
}
}
}
}
if (isset($this->_options['offline'])) {
$this->log(3, 'Skipping dependency download check, --offline specified');
}
if (!count($params)) {
$a = array();
return $a;
}
while (PEAR_Downloader_Package::mergeDependencies($params)) {
}
PEAR_Downloader_Package::removeInstalled($params);
if (!count($params)) {
$this->pushError('No valid packages found', PEAR_INSTALLER_FAILED);
$a = array();
return $a;
}
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$err = $this->analyzeDependencies($params);
PEAR::popErrorHandling();
if (!count($params)) {
$this->pushError('No valid packages found', PEAR_INSTALLER_FAILED);
$a = array();
return $a;
}
$ret = array();
$newparams = array();
if (isset($this->_options['pretend'])) {
return $params;
}
foreach ($params as $i => $package) {
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$pf =& $params[$i]->download();
PEAR::staticPopErrorHandling();
if (PEAR::isError($pf)) {
if (!isset($this->_options['soft'])) {
$this->log(1, $pf->getMessage());
$this->log(0, 'Error: cannot download "' . $this->_registry->parsedPackageNameToString($package->getParsedPackage(), true) . '"');
}
continue;
}
$newparams[] =& $params[$i];
$ret[] = array('file' => $pf->getArchiveFile(), 'info' => &$pf, 'pkg' => $pf->getPackage());
}
$this->_downloadedPackages = $ret;
return $newparams;
}
示例5: warning
function warning($msg)
{
return array(sprintf($msg, $this->_registry->parsedPackageNameToString($this->_currentPackage, true)));
}
示例6: elseif
/**
* @param array output of package.getDownloadURL
* @param string|array|object information for detecting packages to be downloaded, and
* for errors
* @param array name information of the package
* @param array|null packages to be downloaded
* @param bool is this an optional dependency?
* @param bool is this any kind of dependency?
* @access private
*/
function _analyzeDownloadURL($info, $param, $pname, $params = null, $optional = false, $isdependency = false)
{
if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) {
return false;
}
if ($info === false) {
$saveparam = !is_string($param) ? ", cannot download \"{$param}\"" : '';
// no releases exist
return PEAR::raiseError('No releases for package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam);
}
if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) {
$err = false;
if ($pname['channel'] == 'pecl.php.net') {
if ($info['info']->getChannel() != 'pear.php.net') {
$err = true;
}
} elseif ($info['info']->getChannel() == 'pecl.php.net') {
if ($pname['channel'] != 'pear.php.net') {
$err = true;
}
} else {
$err = true;
}
if ($err) {
return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] . '" retrieved another channel\'s name for download! ("' . $info['info']->getChannel() . '")');
}
}
$preferred_state = $this->_config->get('preferred_state');
if (!isset($info['url'])) {
$package_version = $this->_registry->packageInfo($info['info']->getPackage(), 'version', $info['info']->getChannel());
if ($this->isInstalled($info)) {
if ($isdependency && version_compare($info['version'], $package_version, '<=')) {
// ignore bogus errors of "failed to download dependency"
// if it is already installed and the one that would be
// downloaded is older or the same version (Bug #7219)
return false;
}
}
if ($info['version'] === $package_version) {
if (!isset($options['soft'])) {
$this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . '-' . $package_version . ', additionally the suggested version' . ' (' . $package_version . ') is the same as the locally installed one.');
}
return false;
}
if (version_compare($info['version'], $package_version, '<=')) {
if (!isset($options['soft'])) {
$this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . '-' . $package_version . ', additionally the suggested version' . ' (' . $info['version'] . ') is a lower version than the locally installed one (' . $package_version . ').');
}
return false;
}
$instead = ', will instead download version ' . $info['version'] . ', stability "' . $info['info']->getState() . '"';
// releases exist, but we failed to get any
if (isset($this->_downloader->_options['force'])) {
if (isset($pname['version'])) {
$vs = ', version "' . $pname['version'] . '"';
} elseif (isset($pname['state'])) {
$vs = ', stability "' . $pname['state'] . '"';
} elseif ($param == 'dependency') {
if (!class_exists('PEAR_Common')) {
require_once 'PEAR/Common.php';
}
if (!in_array($info['info']->getState(), PEAR_Common::betterStates($preferred_state, true))) {
if ($optional) {
// don't spit out confusing error message
return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
}
$vs = ' within preferred state "' . $preferred_state . '"';
} else {
if (!class_exists('PEAR_Dependency2')) {
require_once 'PEAR/Dependency2.php';
}
if ($optional) {
// don't spit out confusing error message
return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
}
$vs = PEAR_Dependency2::_getExtraString($pname);
$instead = '';
}
} else {
$vs = ' within preferred state "' . $preferred_state . '"';
}
if (!isset($options['soft'])) {
$this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . $vs . $instead);
}
// download the latest release
return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
} else {
if (isset($info['php']) && $info['php']) {
$err = PEAR::raiseError('Failed to download ' . $this->_registry->parsedPackageNameToString(array('channel' => $pname['channel'], 'package' => $pname['package']), true) . ', latest release is version ' . $info['php']['v'] . ', but it requires PHP version "' . $info['php']['m'] . '", use "' . $this->_registry->parsedPackageNameToString(array('channel' => $pname['channel'], 'package' => $pname['package'], 'version' => $info['php']['v'])) . '" to install', PEAR_DOWNLOADER_PACKAGE_PHPVERSION);
return $err;
//.........这里部分代码省略.........
示例7: elseif
/**
* @param array output of package.getDownloadURL
* @param string|array|object information for detecting packages to be downloaded, and
* for errors
* @param array name information of the package
* @param array|null packages to be downloaded
* @param bool is this an optional dependency?
* @access private
*/
function _analyzeDownloadURL($info, $param, $pname, $params = null, $optional = false)
{
if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) {
return false;
}
if (!$info) {
if (!is_string($param)) {
$saveparam = ", cannot download \"{$param}\"";
} else {
$saveparam = '';
}
// no releases exist
return PEAR::raiseError('No releases for package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam);
}
if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) {
$err = false;
if ($pname['channel'] == 'pecl.php.net') {
if ($info['info']->getChannel() != 'pear.php.net') {
$err = true;
}
} elseif ($info['info']->getChannel() == 'pecl.php.net') {
if ($pname['channel'] != 'pear.php.net') {
$err = true;
}
} else {
$err = true;
}
if ($err) {
return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] . '" retrieved another channel\'s name for download! ("' . $info['info']->getChannel() . '")');
}
}
if (!isset($info['url'])) {
$instead = ', will instead download version ' . $info['version'] . ', stability "' . $info['info']->getState() . '"';
// releases exist, but we failed to get any
if (isset($this->_downloader->_options['force'])) {
if (isset($pname['version'])) {
$vs = ', version "' . $pname['version'] . '"';
} elseif (isset($pname['state'])) {
$vs = ', stability "' . $pname['state'] . '"';
} elseif ($param == 'dependency') {
if (!class_exists('PEAR_Common')) {
require_once 'PEAR/Common.php';
}
if (!in_array($info['info']->getState(), PEAR_Common::betterStates($this->_config->get('preferred_state'), true))) {
if ($optional) {
// don't spit out confusing error message
return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
}
$vs = ' within preferred state "' . $this->_config->get('preferred_state') . '"';
} else {
if (!class_exists('PEAR_Dependency2')) {
require_once 'PEAR/Dependency2.php';
}
if ($optional) {
// don't spit out confusing error message
return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
}
$vs = PEAR_Dependency2::_getExtraString($pname);
$instead = '';
}
} else {
$vs = ' within preferred state "' . $this->_config->get('preferred_state') . '"';
}
if (!isset($options['soft'])) {
$this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . $vs . $instead);
}
// download the latest release
return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
} else {
// construct helpful error message
if (isset($pname['version'])) {
$vs = ', version "' . $pname['version'] . '"';
} elseif (isset($pname['state'])) {
$vs = ', stability "' . $pname['state'] . '"';
} elseif ($param == 'dependency') {
if (!class_exists('PEAR_Common')) {
require_once 'PEAR/Common.php';
}
if (!in_array($info['info']->getState(), PEAR_Common::betterStates($this->_config->get('preferred_state'), true))) {
if ($optional) {
// don't spit out confusing error message, and don't die on
// optional dep failure!
return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
}
$vs = ' within preferred state "' . $this->_config->get('preferred_state') . '"';
} else {
if (!class_exists('PEAR_Dependency2')) {
require_once 'PEAR/Dependency2.php';
}
if ($optional) {
// don't spit out confusing error message, and don't die on
//.........这里部分代码省略.........
示例8: installBinary
/**
* Installation of source package has failed, attempt to download and install the
* binary version of this package.
* @param PEAR_Installer
* @return array|false
*/
function installBinary(&$installer)
{
if (!OS_WINDOWS) {
$a = false;
return $a;
}
if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
$releasetype = $this->getPackageType() . 'release';
if (!is_array($installer->getInstallPackages())) {
$a = false;
return $a;
}
foreach ($installer->getInstallPackages() as $p) {
if ($p->isExtension($this->_packageInfo['providesextension'])) {
if ($p->getPackageType() != 'extsrc' && $p->getPackageType() != 'zendextsrc') {
$a = false;
return $a;
// the user probably downloaded it separately
}
}
}
if (isset($this->_packageInfo[$releasetype]['binarypackage'])) {
$installer->log(0, 'Attempting to download binary version of extension "' . $this->_packageInfo['providesextension'] . '"');
$params = $this->_packageInfo[$releasetype]['binarypackage'];
if (!is_array($params) || !isset($params[0])) {
$params = array($params);
}
if (isset($this->_packageInfo['channel'])) {
foreach ($params as $i => $param) {
$params[$i] = array('channel' => $this->_packageInfo['channel'], 'package' => $param, 'version' => $this->getVersion());
}
}
$dl =& $this->getPEARDownloader($installer->ui, $installer->getOptions(), $installer->config);
$verbose = $dl->config->get('verbose');
$dl->config->set('verbose', -1);
foreach ($params as $param) {
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$ret = $dl->download(array($param));
PEAR::popErrorHandling();
if (is_array($ret) && count($ret)) {
break;
}
}
$dl->config->set('verbose', $verbose);
if (is_array($ret)) {
if (count($ret) == 1) {
$pf = $ret[0]->getPackageFile();
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$err = $installer->install($ret[0]);
PEAR::popErrorHandling();
if (is_array($err)) {
$this->_packageInfo['#binarypackage'] = $ret[0]->getPackage();
// "install" self, so all dependencies will work transparently
$this->_registry->addPackage2($this);
$installer->log(0, 'Download and install of binary extension "' . $this->_registry->parsedPackageNameToString(array('channel' => $pf->getChannel(), 'package' => $pf->getPackage()), true) . '" successful');
$a = array($ret[0], $err);
return $a;
}
$installer->log(0, 'Download and install of binary extension "' . $this->_registry->parsedPackageNameToString(array('channel' => $pf->getChannel(), 'package' => $pf->getPackage()), true) . '" failed');
}
}
}
}
$a = false;
return $a;
}