本文整理汇总了PHP中PEAR_Config::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Config::get方法的具体用法?PHP PEAR_Config::get怎么用?PHP PEAR_Config::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Config
的用法示例。
在下文中一共展示了PEAR_Config::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processInstallation
/**
* This is called for each file to set up the directories and files
* @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
* @param array attributes from the <file> tag
* @param string file name
* @return array an array consisting of:
*
* 1 the original, pre-baseinstalldir installation directory
* 2 the final installation directory
* 3 the full path to the final location of the file
* 4 the location of the pre-installation file
*/
function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
{
if (!$this->_setup['locationconfig']) {
return false;
}
if ($this->_setup['honorsbaseinstall']) {
$dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], $layer, $pkg->getChannel());
if (!empty($atts['baseinstalldir'])) {
$dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
}
} elseif ($this->_setup['unusualbaseinstall']) {
$dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], null, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
if (!empty($atts['baseinstalldir'])) {
$dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
}
} else {
$dest_dir = $save_destdir = $this->config->get($this->_setup['locationconfig'], null, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
}
if (dirname($file) != '.' && empty($atts['install-as'])) {
$dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
}
if (empty($atts['install-as'])) {
$dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
} else {
$dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
}
$orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
// Clean up the DIRECTORY_SEPARATOR mess
$ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!{$ds2}+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array($dest_dir, $dest_file, $orig_file));
return array($save_destdir, $dest_dir, $dest_file, $orig_file);
}
示例2: load
/**
* @param string $suiteClassName
* @param string $suiteClassFile
* @return ReflectionClass
* @throws Exception
* @access public
*/
public function load($suiteClassName, $suiteClassFile = '')
{
$suiteClassName = str_replace('.php', '', $suiteClassName);
$suiteClassFile = !empty($suiteClassFile) ? $suiteClassFile : str_replace('_', '/', $suiteClassName) . '.php';
if (!class_exists($suiteClassName)) {
if (!file_exists($suiteClassFile)) {
$config = new PEAR_Config();
$includePaths = explode(PATH_SEPARATOR, get_include_path());
$includePaths[] = $config->get('test_dir');
foreach ($includePaths as $includePath) {
$file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
if (file_exists($file)) {
$suiteClassFile = $file;
break;
}
}
}
PHPUnit2_Util_Fileloader::checkAndLoad($suiteClassFile);
}
if (class_exists($suiteClassName)) {
return new ReflectionClass($suiteClassName);
} else {
throw new Exception(sprintf('Class %s could not be found in %s.', $suiteClassName, $suiteClassFile));
}
}
示例3: 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;
}
示例4: init
/**
* Initialize Task.
* This method includes any necessary PHPUnit2 libraries and triggers
* appropriate error if they cannot be found. This is not done in header
* because we may want this class to be loaded w/o triggering an error.
*/
function init()
{
if (version_compare(PHP_VERSION, '5.0.3') < 0) {
throw new BuildException("PHPUnit2Task requires PHP version >= 5.0.3.", $this->getLocation());
}
/**
* Ugly hack to get PHPUnit version number
*/
$config = new PEAR_Config();
$registry = new PEAR_Registry($config->get('php_dir'));
$pkg_info = $registry->_packageInfo("PHPUnit", null, "pear.phpunit.de");
if ($pkg_info != NULL) {
if (version_compare($pkg_info['version']['api'], "3.0.0") >= 0) {
PHPUnitUtil::$installedVersion = 3;
} else {
PHPUnitUtil::$installedVersion = 2;
}
} else {
/**
* Try to find PHPUnit2
*/
require_once 'PHPUnit2/Util/Filter.php';
if (!class_exists('PHPUnit2_Util_Filter')) {
throw new BuildException("PHPUnit2Task depends on PEAR PHPUnit2 package being installed.", $this->getLocation());
}
PHPUnitUtil::$installedVersion = 2;
}
// other dependencies that should only be loaded when class is actually used.
require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
require_once 'phing/tasks/ext/phpunit/BatchTest.php';
require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
//require_once 'phing/tasks/ext/phpunit/SummaryPHPUnit2ResultFormatter.php';
// add some defaults to the PHPUnit filter
if (PHPUnitUtil::$installedVersion == 3) {
require_once 'PHPUnit/Util/Filter.php';
// point PHPUnit_MAIN_METHOD define to non-existing method
define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
} else {
require_once 'PHPUnit2/Util/Filter.php';
PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
PHPUnit2_Util_Filter::addFileToFilter('phing.php');
}
}
示例5: initPostinstallScripts
/**
* Initialize post-install scripts for running
*
* This method can be used to detect post-install scripts, as the return value
* indicates whether any exist
* @return bool
*/
function initPostinstallScripts()
{
$filelist = $this->getFilelist();
$contents = $this->getContents();
$contents = $contents['dir']['file'];
if (!is_array($contents) || !isset($contents[0])) {
$contents = array($contents);
}
$taskfiles = array();
foreach ($contents as $file) {
$atts = $file['attribs'];
unset($file['attribs']);
if (count($file)) {
$taskfiles[$atts['name']] = $file;
}
}
$common = new PEAR_Common();
$common->debug = $this->_config->get('verbose');
$this->_scripts = array();
foreach ($taskfiles as $name => $tasks) {
if (!isset($filelist[$name])) {
// file was not installed due to installconditions
continue;
}
$atts = $filelist[$name];
foreach ($tasks as $tag => $raw) {
$taskname = $this->getTask($tag);
$task =& new $taskname($this->_config, $common, PEAR_TASK_INSTALL);
if (!$task->isScript()) {
continue;
// scripts are only handled after installation
}
$lastversion = isset($this->_packageInfo['_lastversion']) ? $this->_packageInfo['_lastversion'] : null;
$task->init($raw, $atts, $lastversion);
$res = $task->startSession($this, $atts['installed_as']);
if (!$res) {
continue;
// skip this file
}
if (PEAR::isError($res)) {
return $res;
}
$assign =& $task;
$this->_scripts[] =& $assign;
}
}
if (count($this->_scripts)) {
return true;
}
return false;
}
示例6: createGpgCmd
function createGpgCmd()
{
if ($this->_config->get('sig_type') != 'gpg') {
return PEAR::raiseError("only support 'gpg' for signature type");
}
$sig_bin = $this->_config->get('sig_bin');
if (empty($sig_bin) || !file_exists($sig_bin)) {
return PEAR::raiseError("can't access gpg binary: {$sig_bin}");
}
$keyid = trim($this->_config->get('sig_keyid'));
$keydir = trim($this->_config->get('sig_keydir'));
if (strlen($keydir) && !file_exists($keydir) && !@mkdir($keydir)) {
return PEAR::raiseError("sig_keydir '{$keydir}' doesn't exist or is not accessible");
}
$cmd = escapeshellcmd($sig_bin);
if (strlen($keyid)) {
$cmd .= " --default-key " . escapeshellarg($keyid);
}
if (strlen($keydir)) {
$cmd .= " --homedir " . escapeshellarg($keydir);
}
return $cmd;
}
示例7: processInstallation
/**
* This is called for each file to set up the directories and files
* @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
* @param array attributes from the <file> tag
* @param string file name
* @return array an array consisting of:
*
* 1 the original, pre-baseinstalldir installation directory
* 2 the final installation directory
* 3 the full path to the final location of the file
* 4 the location of the pre-installation file
*/
function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
{
$role = $this->getRoleFromClass();
$info = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . $role);
if (PEAR::isError($info)) {
return $info;
}
if (!$info['locationconfig']) {
return false;
}
if ($info['honorsbaseinstall']) {
$dest_dir = $save_destdir = $this->config->get($info['locationconfig'], $layer, $pkg->getChannel());
if (!empty($atts['baseinstalldir'])) {
$dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
}
} elseif ($info['unusualbaseinstall']) {
$dest_dir = $save_destdir = $this->config->get($info['locationconfig'], $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
if (!empty($atts['baseinstalldir'])) {
$dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
}
} else {
$save_destdir = $dest_dir = $this->config->get($info['locationconfig'], $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
}
if (dirname($file) != '.' && empty($atts['install-as'])) {
$dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
}
if (empty($atts['install-as'])) {
$dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
} else {
$dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
}
$orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
// Clean up the DIRECTORY_SEPARATOR mess
$ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!{$ds2}+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array($dest_dir, $dest_file, $orig_file));
return array($save_destdir, $dest_dir, $dest_file, $orig_file);
}
示例8: 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';
}
示例9: getPackageDownloadUrl
function getPackageDownloadUrl($package, $version = null)
{
if ($version) {
$package .= "-{$version}";
}
if ($this === null || $this->_config === null) {
$package = "http://pear.php.net/get/{$package}";
} else {
$package = "http://" . $this->_config->get('master_server') . "/get/{$package}";
}
if (!extension_loaded("zlib")) {
$package .= '?uncompress=yes';
}
return $package;
}
示例10: __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);
}
示例11: getSampleDir
static function getSampleDir()
{
$config = new PEAR_Config();
return $config->get('data_dir') . '/XML_Feed_Parser/samples';
}
示例12: 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;
//.........这里部分代码省略.........
示例13: realpath
/**
* Create a PEAR_PackageFile_v* from a compresed Tar or Tgz file.
* @access public
* @param string contents of package.xml file
* @param int package state (one of PEAR_VALIDATE_* constants)
* @return PEAR_PackageFile_v1|PEAR_PackageFile_v2
* @using Archive_Tar to extract the files
* @using fromPackageFile() to load the package after the package.xml
* file is extracted.
*/
function &fromTgzFile($file, $state)
{
if (!class_exists('Archive_Tar')) {
require_once 'Archive/Tar.php';
}
$tar = new Archive_Tar($file);
if ($this->_debug <= 1) {
$tar->pushErrorHandling(PEAR_ERROR_RETURN);
}
$content = $tar->listContent();
if ($this->_debug <= 1) {
$tar->popErrorHandling();
}
if (!is_array($content)) {
if (is_string($file) && strlen($file < 255) && (!file_exists($file) || !@is_file($file))) {
$ret = PEAR::raiseError("could not open file \"{$file}\"");
return $ret;
}
$file = realpath($file);
$ret = PEAR::raiseError("Could not get contents of package \"{$file}\"" . '. Invalid tgz file.');
return $ret;
}
if (!count($content) && !@is_file($file)) {
$ret = PEAR::raiseError("could not open file \"{$file}\"");
return $ret;
}
$xml = null;
$origfile = $file;
foreach ($content as $file) {
$name = $file['filename'];
if ($name == 'package2.xml') {
// allow a .tgz to distribute both versions
$xml = $name;
break;
}
if ($name == 'package.xml') {
$xml = $name;
break;
} elseif (preg_match('/package.xml$/', $name, $match)) {
$xml = $name;
break;
}
}
$tmpdir = System::mktemp('-t "' . $this->_config->get('temp_dir') . '" -d pear');
if ($tmpdir === false) {
$ret = PEAR::raiseError("there was a problem with getting the configured temp directory");
return $ret;
}
PEAR_PackageFile::addTempFile($tmpdir);
$this->_extractErrors();
PEAR::staticPushErrorHandling(PEAR_ERROR_CALLBACK, array($this, '_extractErrors'));
if (!$xml || !$tar->extractList(array($xml), $tmpdir)) {
$extra = implode("\n", $this->_extractErrors());
if ($extra) {
$extra = ' ' . $extra;
}
PEAR::staticPopErrorHandling();
$ret = PEAR::raiseError('could not extract the package.xml file from "' . $origfile . '"' . $extra);
return $ret;
}
PEAR::staticPopErrorHandling();
$ret =& PEAR_PackageFile::fromPackageFile("{$tmpdir}/{$xml}", $state, $origfile);
return $ret;
}
示例14: getPassword
/**
* (non-PHPdoc)
* @see lib/Faett/Core/Interfaces/Faett_Core_Interfaces_Service#getPassword($channel)
*/
public function getPassword($channel, $layer = 'user')
{
// return the password for channel
return $this->_config->get('password', $layer, $channel);
}
示例15: getSchemaDir
/**
* Get directory holding RNG schemas. Method is based on that
* found in Contact_AddressBook.
*
* @return string PEAR data directory.
* @access public
* @static
*/
static function getSchemaDir()
{
require_once 'PEAR/Config.php';
$config = new PEAR_Config();
return $config->get('data_dir') . '/XML_Feed_Parser/schemas';
}