本文整理匯總了PHP中PEAR_PackageFile::fromArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_PackageFile::fromArray方法的具體用法?PHP PEAR_PackageFile::fromArray怎麽用?PHP PEAR_PackageFile::fromArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PEAR_PackageFile
的用法示例。
在下文中一共展示了PEAR_PackageFile::fromArray方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
/**
* @param string Package name
* @param string Channel name
* @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|null
* @access private
*/
function &_getPackage($package, $channel = 'pear.php.net')
{
$info = $this->_packageInfo($package, null, $channel);
if ($info === null) {
return $info;
}
$a = $this->_config;
if (!$a) {
$this->_config = new PEAR_Config();
$this->_config->set('php_dir', $this->statedir);
}
if (!class_exists('PEAR_PackageFile')) {
require_once 'PEAR/PackageFile.php';
}
$pkg = new PEAR_PackageFile($this->_config);
$pf =& $pkg->fromArray($info);
return $pf;
}
示例2: xmlFromInfo
/**
* Return an XML document based on the package info (as returned
* by the PEAR_Common::infoFrom* methods).
*
* @param array $pkginfo package info
*
* @return string XML data
*
* @access public
* @deprecated use a PEAR_PackageFile_v* object's generator instead
*/
function xmlFromInfo($pkginfo)
{
$config =& PEAR_Config::singleton();
$packagefile = new PEAR_PackageFile($config);
$pf =& $packagefile->fromArray($pkginfo);
$gen =& $pf->getDefaultGenerator();
return $gen->toXml(PEAR_VALIDATE_PACKAGING);
}
示例3: install
//.........這裏部分代碼省略.........
if (strtolower($info[1]) == strtolower($param->getPackage()) && strtolower($info[0]) == strtolower($param->getChannel())) {
if (isset($parentreg['filelist'][$file])) {
unset($parentreg['filelist'][$file]);
} else {
$pos = strpos($file, '/');
$basedir = substr($file, 0, $pos);
$file2 = substr($file, $pos + 1);
if (isset($parentreg['filelist'][$file2]['baseinstalldir']) && $parentreg['filelist'][$file2]['baseinstalldir'] === $basedir) {
unset($parentreg['filelist'][$file2]);
}
}
unset($test[$file]);
}
} else {
if (strtolower($param->getChannel()) != 'pear.php.net') {
continue;
}
if (strtolower($info) == strtolower($param->getPackage())) {
if (isset($parentreg['filelist'][$file])) {
unset($parentreg['filelist'][$file]);
} else {
$pos = strpos($file, '/');
$basedir = substr($file, 0, $pos);
$file2 = substr($file, $pos + 1);
if (isset($parentreg['filelist'][$file2]['baseinstalldir']) && $parentreg['filelist'][$file2]['baseinstalldir'] === $basedir) {
unset($parentreg['filelist'][$file2]);
}
}
unset($test[$file]);
}
}
}
$pfk = new PEAR_PackageFile($this->config);
$parentpkg =& $pfk->fromArray($parentreg);
$installregistry->updatePackage2($parentpkg);
}
if ($param->getChannel() == 'pecl.php.net' && isset($options['upgrade'])) {
$tmp = $test;
foreach ($tmp as $file => $info) {
if (is_string($info)) {
// pear.php.net packages are always stored as strings
if (strtolower($info) == strtolower($param->getPackage())) {
// upgrading existing package
unset($test[$file]);
}
}
}
}
if (count($test)) {
$msg = "{$channel}/{$pkgname}: conflicting files found:\n";
$longest = max(array_map("strlen", array_keys($test)));
$fmt = "%{$longest}s (%s)\n";
foreach ($test as $file => $info) {
if (!is_array($info)) {
$info = array('pear.php.net', $info);
}
$info = $info[0] . '/' . $info[1];
$msg .= sprintf($fmt, $file, $info);
}
if (!isset($options['ignore-errors'])) {
return $this->raiseError($msg);
}
if (!isset($options['soft'])) {
$this->log(0, "WARNING: {$msg}");
}
}