本文整理匯總了PHP中PEAR_Registry::getPackage方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_Registry::getPackage方法的具體用法?PHP PEAR_Registry::getPackage怎麽用?PHP PEAR_Registry::getPackage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PEAR_Registry
的用法示例。
在下文中一共展示了PEAR_Registry::getPackage方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rebuildDB
/**
* Rebuild the dependency DB by reading registry entries.
* @return true|PEAR_Error
*/
function rebuildDB()
{
$depdb = array('_version' => $this->_version);
if (!$this->hasWriteAccess()) {
// allow startup for read-only with older Registry
return $depdb;
}
$packages = $this->_registry->listAllPackages();
if (PEAR::isError($packages)) {
return $packages;
}
foreach ($packages as $channel => $ps) {
foreach ($ps as $package) {
$package = $this->_registry->getPackage($package, $channel);
if (PEAR::isError($package)) {
return $package;
}
$this->_setPackageDeps($depdb, $package);
}
}
$error = $this->_writeDepDB($depdb);
if (PEAR::isError($error)) {
return $error;
}
$this->_cache = $depdb;
return true;
}
示例2: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @return void
*/
protected function setUp()
{
$reg = new PEAR_Registry();
if ($reg->getPackage("PEAR_Size") == null) {
$this->markTestSkipped("PEAR_Size is not installed.");
}
$this->cli = new PEAR_Size_CLI();
$this->genericResponse = "Usage: pearsize [OPTIONS] [PACKAGE]\nDisplay information on how much space an installed PEAR package required.\n\n -a, --all display information for all installed packages\n -A, --allchannels list packages from all channels, not just the default one\n -c, --channel specify which channel\n -C, --csv output results in CSV format (sizes are measured in bytes).\n -h, --human-readable print sizes in human readable format (for example: 492 B 1KB 7MB)\n -H, --si likewise, but use powers of 1000 not 1024\n -t, --type specify what type of files are required for the report\n by default all types are assumed\n -s, --summarise display channel summary view\n -S, --fsort sort by file size\n -v, --verbose display more detailed information\n --help display this help and exit\n -V, --version output version information and exit\n -X, --xml output results in XML format\n -0, --killzero do not output zero values in verbose mode\n\nTypes:\nYou can specify a subset of roles/file-types to be listed in the report.\nThese roles are those as supported by the PEAR installer.\nThese are: data, doc, ext, php, script, src, test\n\nExamples:\n \$ pearsize --all\n \$ pearsize Console_Table\n \$ pearsize -ttest,doc Console_Table\n \$ pearsize --type=test,doc,php -h Console_Table Date_Holidays\n";
$this->genericIntegratedResponse = "Usage: pear size [OPTIONS] [PACKAGE]\nDisplay information on how much space an installed PEAR package required.\n\n -a, --all display information for all installed packages\n -A, --allchannels list packages from all channels, not just the default one\n -c, --channel specify which channel\n -C, --csv output results in CSV format (sizes are measured in bytes).\n -h, --human-readable print sizes in human readable format (for example: 492 B 1KB 7MB)\n -H, --si likewise, but use powers of 1000 not 1024\n -t, --type specify what type of files are required for the report\n by default all types are assumed\n -s, --summarise display channel summary view\n -S, --fsort sort by file size\n -v, --verbose display more detailed information\n --help display this help and exit\n -V, --version output version information and exit\n -X, --xml output results in XML format\n -0, --killzero do not output zero values in verbose mode\n\nTypes:\nYou can specify a subset of roles/file-types to be listed in the report.\nThese roles are those as supported by the PEAR installer.\nThese are: data, doc, ext, php, script, src, test\n\nExamples:\n \$ pear size --all\n \$ pear size Console_Table\n \$ pear size -ttest,doc Console_Table\n \$ pear size --type=test,doc,php -h Console_Table Date_Holidays\n";
}
示例3: packages
/**
* Return PEAR packages, versions, etc.
*
* @see PEAR_Registry, PEAR_Registry::listPackages()
* @return array
*/
public function packages()
{
$reg = new PEAR_Registry();
$packages = $reg->listPackages();
$p = array();
foreach ($packages as $package) {
$pkg = $reg->getPackage($package);
$p[] = array('package' => $pkg->getName(), 'released' => $pkg->getDate(), 'version' => $pkg->getVersion(), 'state' => $pkg->getState());
}
return array('packages' => $p);
}
示例4: rebuildDB
/**
* Rebuild the dependency DB by reading registry entries.
* @return true|PEAR_Error
*/
function rebuildDB()
{
$depdb = array('_version' => $this->_version);
$packages = $this->_registry->listAllPackages();
foreach ($packages as $channel => $ps) {
foreach ($ps as $package) {
$package = $this->_registry->getPackage($package, $channel);
$this->_setPackageDeps($depdb, $package);
}
}
$error = $this->_writeDepDB($depdb);
if (PEAR::isError($error)) {
return $error;
}
$this->_cache = $depdb;
return true;
}
示例5: doInstall
function doInstall($command, $options, $params)
{
if (!class_exists('PEAR_PackageFile')) {
require_once 'PEAR/PackageFile.php';
}
if (empty($this->installer)) {
$this->installer =& $this->getInstaller($this->ui);
}
if ($command == 'upgrade' || $command == 'upgrade-all') {
$options['upgrade'] = true;
} else {
$packages = $params;
}
if (isset($options['installroot']) && isset($options['packagingroot'])) {
return $this->raiseError('ERROR: cannot use both --installroot and --packagingroot');
}
$reg =& $this->config->getRegistry();
$instreg =& $reg;
// instreg used to check if package is installed
if (isset($options['packagingroot']) && !isset($options['upgrade'])) {
$packrootphp_dir = $this->installer->_prependPath($this->config->get('php_dir', null, 'pear.php.net'), $options['packagingroot']);
$instreg = new PEAR_Registry($packrootphp_dir);
// other instreg!
if ($this->config->get('verbose') > 2) {
$this->ui->outputData('using package root: ' . $options['packagingroot']);
}
}
$abstractpackages = array();
$otherpackages = array();
// parse params
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
foreach ($params as $param) {
if (strpos($param, 'http://') === 0) {
$otherpackages[] = $param;
continue;
}
if (strpos($param, 'channel://') === false && @file_exists($param)) {
if (isset($options['force'])) {
$otherpackages[] = $param;
continue;
}
$pkg = new PEAR_PackageFile($this->config);
$pf = $pkg->fromAnyFile($param, PEAR_VALIDATE_DOWNLOADING);
if (PEAR::isError($pf)) {
$otherpackages[] = $param;
continue;
}
if ($reg->packageExists($pf->getPackage(), $pf->getChannel()) && version_compare($pf->getVersion(), $reg->packageInfo($pf->getPackage(), 'version', $pf->getChannel()), '<=')) {
if ($this->config->get('verbose')) {
$this->ui->outputData('Ignoring installed package ' . $reg->parsedPackageNameToString(array('package' => $pf->getPackage(), 'channel' => $pf->getChannel()), true));
}
continue;
}
$otherpackages[] = $param;
continue;
}
$e = $reg->parsePackageName($param, $this->config->get('default_channel'));
if (PEAR::isError($e)) {
$otherpackages[] = $param;
} else {
$abstractpackages[] = $e;
}
}
PEAR::staticPopErrorHandling();
// if there are any local package .tgz or remote static url, we can't
// filter. The filter only works for abstract packages
if (count($abstractpackages) && !isset($options['force'])) {
// when not being forced, only do necessary upgrades/installs
if (isset($options['upgrade'])) {
$abstractpackages = $this->_filterUptodatePackages($abstractpackages, $command);
} else {
foreach ($abstractpackages as $i => $package) {
if (isset($package['group'])) {
// do not filter out install groups
continue;
}
if ($instreg->packageExists($package['package'], $package['channel'])) {
if ($this->config->get('verbose')) {
$this->ui->outputData('Ignoring installed package ' . $reg->parsedPackageNameToString($package, true));
}
unset($abstractpackages[$i]);
}
}
}
$abstractpackages = array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
} elseif (count($abstractpackages)) {
$abstractpackages = array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
}
$packages = array_merge($abstractpackages, $otherpackages);
if (!count($packages)) {
$this->ui->outputData('Nothing to ' . $command);
return true;
}
$this->downloader =& $this->getDownloader($this->ui, $options, $this->config);
$errors = array();
$binaries = array();
$downloaded = array();
$downloaded =& $this->downloader->download($packages);
if (PEAR::isError($downloaded)) {
return $this->raiseError($downloaded);
//.........這裏部分代碼省略.........
示例6: array
function _detect1($deps, $pname, $options, $params)
{
$this->_downloadDeps = array();
$skipnames = array();
foreach ($deps as $dep) {
$nodownload = false;
if ($dep['type'] == 'pkg') {
$dep['channel'] = 'pear.php.net';
$dep['package'] = $dep['name'];
switch ($dep['rel']) {
case 'not':
continue 2;
case 'ge':
case 'eq':
case 'gt':
case 'has':
$group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
if (PEAR_Downloader_Package::willDownload($dep, $params)) {
$this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed');
continue 2;
}
$fakedp = new PEAR_PackageFile_v1();
$fakedp->setPackage($dep['name']);
// skip internet check if we are not upgrading (bug #5810)
if (!isset($options['upgrade']) && $this->isInstalled($fakedp, $dep['rel'])) {
$this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", is already installed');
continue 2;
}
}
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
if ($this->_explicitState) {
$pname['state'] = $this->_explicitState;
}
$url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname);
$chan = 'pear.php.net';
if (PEAR::isError($url)) {
// check to see if this is a pecl package that has jumped
// from pear.php.net to pecl.php.net channel
if (!class_exists('PEAR_Dependency2')) {
require_once 'PEAR/Dependency2.php';
}
$newdep = PEAR_Dependency2::normalizeDep($dep);
$newdep = $newdep[0];
$newdep['channel'] = 'pecl.php.net';
$chan = 'pecl.php.net';
$url = $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname);
$obj =& $this->_registry->getPackage($dep['name']);
if (PEAR::isError($url)) {
PEAR::popErrorHandling();
if ($obj !== null && $this->isInstalled($obj, $dep['rel'])) {
$group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
$dep['package'] = $dep['name'];
if (!isset($options['soft'])) {
$this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", already installed as version ' . $obj->getVersion());
}
if (@$skipnames[count($skipnames) - 1] == $this->_registry->parsedPackageNameToString($dep, true)) {
array_pop($skipnames);
}
continue;
} else {
if (isset($dep['optional']) && $dep['optional'] == 'yes') {
$this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", no releases exist');
continue;
} else {
return $url;
}
}
}
}
PEAR::popErrorHandling();
if (!isset($options['alldeps'])) {
if (isset($dep['optional']) && $dep['optional'] == 'yes') {
if (!isset($options['soft'])) {
$this->_downloader->log(3, 'Notice: package "' . $this->getShortName() . '" optional dependency "' . $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded');
}
$skipnames[] = $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true);
$nodownload = true;
}
}
if (!isset($options['alldeps']) && !isset($options['onlyreqdeps'])) {
if (!isset($dep['optional']) || $dep['optional'] == 'no') {
if (!isset($options['soft'])) {
$this->_downloader->log(3, 'Notice: package "' . $this->getShortName() . '" required dependency "' . $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded');
}
$skipnames[] = $this->_registry->parsedPackageNameToString(array('channel' => $chan, 'package' => $dep['name']), true);
$nodownload = true;
}
}
// check to see if a dep is already installed
// do not try to move this before getDepPackageDownloadURL
// we can't determine whether upgrade is necessary until we know what
// version would be downloaded
if (!isset($options['force']) && $this->isInstalled($url, $dep['rel'])) {
$group = !isset($dep['optional']) || $dep['optional'] == 'no' ? 'required' : 'optional';
$dep['package'] = $dep['name'];
if (isset($newdep)) {
$version = $this->_registry->packageInfo($newdep['name'], 'version', $newdep['channel']);
} else {
$version = $this->_registry->packageInfo($dep['name'], 'version');
}
//.........這裏部分代碼省略.........
示例7: validatePackageUninstall
/**
* Verify that uninstalling packages passed in to command line is OK.
*
* @param PEAR_Installer $dl
* @return PEAR_Error|true
*/
function validatePackageUninstall(&$dl)
{
if (PEAR::isError($this->_dependencydb)) {
return $this->_dependencydb;
}
$params = array();
// construct an array of "downloaded" packages to fool the package dependency checker
// into using these to validate uninstalls of circular dependencies
$downloaded =& $dl->getUninstallPackages();
foreach ($downloaded as $i => $pf) {
if (!class_exists('PEAR_Downloader_Package')) {
require_once 'PEAR/Downloader/Package.php';
}
$dp =& new PEAR_Downloader_Package($dl);
$dp->setPackageFile($downloaded[$i]);
$params[$i] =& $dp;
}
// check cache
$memyselfandI = strtolower($this->_currentPackage['channel']) . '/' . strtolower($this->_currentPackage['package']);
if (isset($dl->___uninstall_package_cache)) {
$badpackages = $dl->___uninstall_package_cache;
if (isset($badpackages[$memyselfandI]['warnings'])) {
foreach ($badpackages[$memyselfandI]['warnings'] as $warning) {
$dl->log(0, $warning[0]);
}
}
if (isset($badpackages[$memyselfandI]['errors'])) {
foreach ($badpackages[$memyselfandI]['errors'] as $error) {
if (is_array($error)) {
$dl->log(0, $error[0]);
} else {
$dl->log(0, $error->getMessage());
}
}
if (isset($this->_options['nodeps']) || isset($this->_options['force'])) {
return $this->warning('warning: %s should not be uninstalled, other installed packages depend ' . 'on this package');
}
return $this->raiseError('%s cannot be uninstalled, other installed packages depend on this package');
}
return true;
}
// first, list the immediate parents of each package to be uninstalled
$perpackagelist = array();
$allparents = array();
foreach ($params as $i => $param) {
$a = array('channel' => strtolower($param->getChannel()), 'package' => strtolower($param->getPackage()));
$deps = $this->_dependencydb->getDependentPackages($a);
if ($deps) {
foreach ($deps as $d) {
$pardeps = $this->_dependencydb->getDependencies($d);
foreach ($pardeps as $dep) {
if (strtolower($dep['dep']['channel']) == $a['channel'] && strtolower($dep['dep']['name']) == $a['package']) {
if (!isset($perpackagelist[$a['channel'] . '/' . $a['package']])) {
$perpackagelist[$a['channel'] . '/' . $a['package']] = array();
}
$perpackagelist[$a['channel'] . '/' . $a['package']][] = array($d['channel'] . '/' . $d['package'], $dep);
if (!isset($allparents[$d['channel'] . '/' . $d['package']])) {
$allparents[$d['channel'] . '/' . $d['package']] = array();
}
if (!isset($allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']])) {
$allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']] = array();
}
$allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']][] = array($d, $dep);
}
}
}
}
}
// next, remove any packages from the parents list that are not installed
$remove = array();
foreach ($allparents as $parent => $d1) {
foreach ($d1 as $d) {
if ($this->_registry->packageExists($d[0][0]['package'], $d[0][0]['channel'])) {
continue;
}
$remove[$parent] = true;
}
}
// next remove any packages from the parents list that are not passed in for
// uninstallation
foreach ($allparents as $parent => $d1) {
foreach ($d1 as $d) {
foreach ($params as $param) {
if (strtolower($param->getChannel()) == $d[0][0]['channel'] && strtolower($param->getPackage()) == $d[0][0]['package']) {
// found it
continue 3;
}
}
$remove[$parent] = true;
}
}
// remove all packages whose dependencies fail
// save which ones failed for error reporting
$badchildren = array();
//.........這裏部分代碼省略.........
示例8: foreach
//.........這裏部分代碼省略.........
if (!$installed && !$downloaded) {
if (isset($dep['conflicts'])) {
return true;
}
if ($required) {
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError('%s requires package "' . $depname . '"' . $extra);
} else {
return $this->warning('warning: %s requires package "' . $depname . '"' . $extra);
}
} else {
return $this->warning('%s can optionally use package "' . $depname . '"' . $extra);
}
}
$fail = false;
if (isset($dep['min'])) {
if (version_compare($version, $dep['min'], '<')) {
$fail = true;
}
}
if (isset($dep['max'])) {
if (version_compare($version, $dep['max'], '>')) {
$fail = true;
}
}
if ($fail && !isset($dep['conflicts'])) {
$installed = $installed ? 'installed' : 'downloaded';
$dep['package'] = $dep['name'];
$dep = $this->_registry->parsedPackageNameToString($dep, true);
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError('%s requires package "' . $depname . '"' . $extra . ", {$installed} version is " . $version);
} else {
return $this->warning('warning: %s requires package "' . $depname . '"' . $extra . ", {$installed} version is " . $version);
}
} elseif ((isset($dep['min']) || isset($dep['max'])) && !$fail && isset($dep['conflicts']) && !isset($dep['exclude'])) {
$installed = $installed ? 'installed' : 'downloaded';
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra . ", {$installed} version is " . $version);
} else {
return $this->warning('warning: %s conflicts with package "' . $depname . '"' . $extra . ", {$installed} version is " . $version);
}
}
if (isset($dep['exclude'])) {
$installed = $installed ? 'installed' : 'downloaded';
foreach ($dep['exclude'] as $exclude) {
if (version_compare($version, $exclude, '==') && !isset($dep['conflicts'])) {
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError('%s is not compatible with ' . $installed . ' package "' . $depname . '" version ' . $exclude);
} else {
return $this->warning('warning: %s is not compatible with ' . $installed . ' package "' . $depname . '" version ' . $exclude);
}
} elseif (version_compare($version, $exclude, '!=') && isset($dep['conflicts'])) {
$installed = $installed ? 'installed' : 'downloaded';
if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra . ", {$installed} version is " . $version);
} else {
return $this->warning('warning: %s conflicts with package "' . $depname . '"' . $extra . ", {$installed} version is " . $version);
}
}
}
}
if (isset($dep['recommended'])) {
$installed = $installed ? 'installed' : 'downloaded';
if (version_compare($version, $dep['recommended'], '==')) {
return true;
} else {
if (!$found && $installed) {
$param = $this->_registry->getPackage($dep['name'], $dep['channel']);
}
if ($param) {
$found = false;
foreach ($params as $parent) {
if ($parent->isEqual($this->_currentPackage)) {
$found = true;
break;
}
}
if ($found) {
if ($param->isCompatible($parent)) {
return true;
}
} else {
// this is for validPackage() calls
$parent = $this->_registry->getPackage($this->_currentPackage['package'], $this->_currentPackage['channel']);
if ($parent !== null) {
if ($param->isCompatible($parent)) {
return true;
}
}
}
}
if (!isset($this->_options['nodeps']) && !isset($this->_options['force']) && !isset($this->_options['loose'])) {
return $this->raiseError('%s dependency package "' . $depname . '" ' . $installed . ' version ' . $version . ' is not the recommended version ' . $dep['recommended'] . ', but may be compatible, use --force to install');
} else {
return $this->warning('warning: %s dependency package "' . $depname . '" ' . $installed . ' version ' . $version . ' is not the recommended version ' . $dep['recommended']);
}
}
}
return true;
}
示例9: install
/**
* Installs the files within the package file specified.
*
* @param string|PEAR_Downloader_Package $pkgfile path to the package file,
* or a pre-initialized packagefile object
* @param array $options
* recognized options:
* - installroot : optional prefix directory for installation
* - force : force installation
* - register-only : update registry but don't install files
* - upgrade : upgrade existing install
* - soft : fail silently
* - nodeps : ignore dependency conflicts/missing dependencies
* - alldeps : install all dependencies
* - onlyreqdeps : install only required dependencies
*
* @return array|PEAR_Error package info if successful
*/
function install($pkgfile, $options = array())
{
$this->_options = $options;
$this->_registry =& $this->config->getRegistry();
if (is_object($pkgfile)) {
$dlpkg =& $pkgfile;
$pkg = $pkgfile->getPackageFile();
$pkgfile = $pkg->getArchiveFile();
$descfile = $pkg->getPackageFile();
} else {
$descfile = $pkgfile;
$pkg = $this->_parsePackageXml($descfile);
if (PEAR::isError($pkg)) {
return $pkg;
}
}
$tmpdir = dirname($descfile);
if (realpath($descfile) != realpath($pkgfile)) {
// Use the temp_dir since $descfile can contain the download dir path
$tmpdir = $this->config->get('temp_dir', null, 'pear.php.net');
$tmpdir = System::mktemp('-d -t "' . $tmpdir . '"');
$tar = new Archive_Tar($pkgfile);
if (!$tar->extract($tmpdir)) {
return $this->raiseError("unable to unpack {$pkgfile}");
}
}
$pkgname = $pkg->getName();
$channel = $pkg->getChannel();
if (isset($this->_options['packagingroot'])) {
$regdir = $this->_prependPath($this->config->get('php_dir', null, 'pear.php.net'), $this->_options['packagingroot']);
$packrootphp_dir = $this->_prependPath($this->config->get('php_dir', null, $channel), $this->_options['packagingroot']);
}
if (isset($options['installroot'])) {
$this->config->setInstallRoot($options['installroot']);
$this->_registry =& $this->config->getRegistry();
$installregistry =& $this->_registry;
$this->installroot = '';
// all done automagically now
$php_dir = $this->config->get('php_dir', null, $channel);
} else {
$this->config->setInstallRoot(false);
$this->_registry =& $this->config->getRegistry();
if (isset($this->_options['packagingroot'])) {
$installregistry = new PEAR_Registry($regdir);
if (!$installregistry->channelExists($channel, true)) {
// we need to fake a channel-discover of this channel
$chanobj = $this->_registry->getChannel($channel, true);
$installregistry->addChannel($chanobj);
}
$php_dir = $packrootphp_dir;
} else {
$installregistry =& $this->_registry;
$php_dir = $this->config->get('php_dir', null, $channel);
}
$this->installroot = '';
}
// {{{ checks to do when not in "force" mode
if (empty($options['force']) && (file_exists($this->config->get('php_dir')) && is_dir($this->config->get('php_dir')))) {
$testp = $channel == 'pear.php.net' ? $pkgname : array($channel, $pkgname);
$instfilelist = $pkg->getInstallationFileList(true);
if (PEAR::isError($instfilelist)) {
return $instfilelist;
}
// ensure we have the most accurate registry
$installregistry->flushFileMap();
$test = $installregistry->checkFileMap($instfilelist, $testp, '1.1');
if (PEAR::isError($test)) {
return $test;
}
if (sizeof($test)) {
$pkgs = $this->getInstallPackages();
$found = false;
foreach ($pkgs as $param) {
if ($pkg->isSubpackageOf($param)) {
$found = true;
break;
}
}
if ($found) {
// subpackages can conflict with earlier versions of parent packages
$parentreg = $installregistry->packageInfo($param->getPackage(), null, $param->getChannel());
$tmp = $test;
//.........這裏部分代碼省略.........
示例10: assertIntegratedExec
/**
* Assert results of pear size script as integrated with the pear command.
*
* @param string $args Arguments list that will be pass to the 'pear size' command
* @param array $exp pear size output results expected
*
* @return void
*/
private function assertIntegratedExec($args, $exp, $status = 0)
{
$reg = new PEAR_Registry();
if ($reg->getPackage("PEAR_Size") == null) {
$this->markTestSkipped("PEAR_Size is not installed.");
}
if ('@PEAR-DIR@' == '@' . 'PEAR-DIR' . '@') {
// Run from source code checkout.
$bin = 'pear';
} else {
// Run from installation.
$bin = '@BIN-DIR@/pear';
}
$command = "'{$bin}' size ";
$return = 0;
ob_start();
passthru("{$command} {$args}", $return);
$output = ob_get_contents();
ob_end_clean();
$this->assertEquals($exp, $output);
$this->assertEquals($status, $return);
}