本文整理汇总了PHP中PEAR_Config::getRegistry方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Config::getRegistry方法的具体用法?PHP PEAR_Config::getRegistry怎么用?PHP PEAR_Config::getRegistry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Config
的用法示例。
在下文中一共展示了PEAR_Config::getRegistry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* @param PEAR_Config
*/
function PEAR_Downloader_Package(&$downloader)
{
$this->_downloader =& $downloader;
$this->_config =& $this->_downloader->config;
$this->_registry =& $this->_config->getRegistry();
$this->_valid = $this->_analyzed = false;
}
示例2: setConfig
/**
* Set up the registry/location of dependency DB
* @param PEAR_Config|false
* @param string|false full path to the dependency database, or false to use default
*/
function setConfig(&$config, $depdb = false)
{
if (!$config) {
$this->_config =& PEAR_Config::singleton();
} else {
$this->_config =& $config;
}
$this->_registry =& $this->_config->getRegistry();
if (!$depdb) {
$this->_depdb = $this->_config->get('php_dir', null, 'pear.php.net') . DIRECTORY_SEPARATOR . '.depdb';
} else {
$this->_depdb = $depdb;
}
$this->_lockfile = dirname($this->_depdb) . DIRECTORY_SEPARATOR . '.depdblock';
}
示例3:
/**
* @param PEAR_Downloader
*/
function PEAR_Downloader_Package(&$downloader)
{
$this->_downloader =& $downloader;
$this->_config =& $this->_downloader->config;
$this->_registry =& $this->_config->getRegistry();
$options = $downloader->getOptions();
if (isset($options['packagingroot'])) {
$this->_config->setInstallRoot($options['packagingroot']);
$this->_installRegistry =& $this->_config->getRegistry();
$this->_config->setInstallRoot(false);
} else {
$this->_installRegistry =& $this->_registry;
}
$this->_valid = $this->_analyzed = false;
}
示例4: __construct
/**
* Constructor.
*
* Searches all installed applications and libraries for migration
* directories and builds lists of migrateable modules and directories.
*
* @param string $basedir Base directory of a Git checkout. If provided
* a framework/ sub directory is searched for
* migration scripts too.
* @param string $pearconf Path to a PEAR configuration file.
*/
public function __construct($basedir = null, $pearconf = null)
{
// Loop through all applications.
foreach ($GLOBALS['registry']->listAllApps() as $app) {
$dir = $GLOBALS['registry']->get('fileroot', $app) . '/migration';
if (is_dir($dir)) {
$this->apps[] = $app;
$this->_lower[] = Horde_String::lower($app);
$this->dirs[] = realpath($dir);
}
}
// Silence PEAR errors.
$old_error_reporting = error_reporting();
error_reporting($old_error_reporting & ~E_DEPRECATED);
$pear = new PEAR_Config($pearconf);
// Loop through local framework checkout.
if ($basedir) {
$packageFile = new PEAR_PackageFile($pear);
foreach (glob($basedir . '/framework/*/migration') as $dir) {
$package = $packageFile->fromPackageFile(dirname($dir) . '/package.xml', PEAR_VALIDATE_NORMAL);
if ($package instanceof PEAR_Error) {
Horde::log(sprintf('%s: %s', $package->getMessage(), print_r($package->getUserInfo(), true)), Horde_Log::ERR);
continue;
}
$this->apps[] = $package->getName();
$this->_lower[] = Horde_String::lower($package->getName());
$this->dirs[] = realpath($dir);
}
}
// Loop through installed PEAR packages.
$registry = $pear->getRegistry();
foreach (glob($pear->get('data_dir') . '/*/migration') as $dir) {
$package = $registry->getPackage(basename(dirname($dir)), 'pear.horde.org');
if ($package == false) {
Horde::log("Ignoring package in directory {$dir}", Horde_Log::WARN);
continue;
}
$app = $package->getName();
if (!in_array($app, $this->apps)) {
$this->apps[] = $app;
$this->_lower[] = Horde_String::lower($app);
$this->dirs[] = realpath($dir);
}
}
error_reporting($old_error_reporting);
}
示例5:
$result = "Database support is ok";
$status = OK;
}
print_row("Database Support", $result, $status);
// PEAR
$have_pear = false;
if (!($pear_dir = find_path($path_list, "PEAR"))) {
$result = "Not installed. The PEAR extension is required by several other " . "PHP extensions that Maia needs. See <a href=\"http://pear.php.net/\">this page</a> " . "for more information about downloading and installing PEAR.";
$status = ERROR;
} else {
// include_once ("PEAR/Remote.php"); // PEAR::Remote
include_once "PEAR/Config.php";
// PEAR::Registry
$have_pear = true;
$pear = new PEAR_Config();
$pear_reg = $pear->getRegistry();
$pear_info = $pear_reg->packageInfo("PEAR");
$pear_list = $pear_reg->listPackages();
$pear_version = is_array($pear_info["version"]) ? $pear_info["version"]["release"] : $pear_info["version"];
$result = $pear_version;
$status = OK;
}
print_row("PEAR", $result, $status);
// PEAR::Mail_Mime
if ($have_pear) {
if (!in_array("mail_mime", $pear_list)) {
$result = "Not installed. This PHP extension is required to decode " . "MIME-structured e-mail. Use <b>pear install Mail_Mime</b> to " . "install this.";
$status = ERROR;
} else {
$info = $pear_reg->packageInfo("Mail_Mime");
$result = is_array($info["version"]) ? $info["version"]["release"] : $info["version"];
示例6: getPackageInfo
/**
* Returns the latest information about the given package.
*
* @access protected
* @return boolean true on success, false on error
* @since 0.4.0a1
* @throws PEAR_PACKAGEUPDATE_ERROR_NOPACKAGE,
* PEAR_PACKAGEUPDATE_ERROR_NOCHANNEL,
* PEAR_PACKAGEUPDATE_ERROR_NOINFO
*/
function getPackageInfo()
{
// Only check once.
if (isset($this->latestVersion) && isset($this->info)) {
return true;
}
// Make sure the channel and package are set.
if (empty($this->packageName)) {
$this->pushError(PEAR_PACKAGEUPDATE_ERROR_NOPACKAGE);
return false;
}
if (empty($this->channel)) {
$this->pushError(PEAR_PACKAGEUPDATE_ERROR_NOCHANNEL);
return false;
}
// Create a config object.
$config = new PEAR_Config();
// Get the config's registry object.
$reg = $config->getRegistry();
// Parse the package name.
$parsed = $reg->parsePackageName($this->channel . '/' . $this->packageName);
// Check for errors.
if (PEAR::isError($parsed)) {
$this->pushError($parsed);
return false;
}
// Get a PEAR_Remote instance.
$r = $config->getRemote();
// Get the package info.
$info = $r->call('package.info', $parsed['package']);
// Check to make sure the package was found.
if (PEAR::isError($info)) {
$this->pushError(PEAR_PACKAGEUPDATE_ERROR_NOINFO, NULL, array('packagename' => $this->packageName));
return false;
}
// Get the installed version of the package.
$this->instVersion = $reg->packageInfo($parsed['package'], 'version', $parsed['channel']);
// If the package is not installed, create a dummy version.
if (empty($this->instVersion)) {
$this->instVersion = '0.0.0';
}
// Pull out the latest information.
$this->latestVersion = reset(array_keys($info['releases']));
$this->info = reset($info['releases']);
return true;
}