/**
  * 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)
 {
     include_once 'PEAR/PackageFile.php';
     include_once 'PEAR/Config.php';
     $config =& PEAR_Config::singleton();
     $packagefile =& new PEAR_PackageFile($config);
     $pf =& $packagefile->fromArray($pkginfo);
     parent::PEAR_PackageFile_Generator_v1($pf);
     return $this->toXml();
 }
 /**
  * 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)
 {
     include_once 'PEAR/PackageFile.php';
     include_once 'PEAR/Config.php';
     $config =& PEAR_Config::singleton();
     $packagefile =& new PEAR_PackageFile($config);
     $pf =& $packagefile->fromArray($pkginfo);
     parent::PEAR_PackageFile_Generator_v1($pf);
     $ret = $this->toXml();
     if (!$ret) {
         $errors = $pf->getValidationWarnings();
         return PEAR::raiseError('Invalid package.xml file', null, null, null, $errors);
     }
     return $ret;
 }
Exemple #3
0
 /**
  * Retrieve a package file based on a previous release
  *
  * @param string $pfcontents contents of the previous release's package.xml
  * @return PEAR_PackageFile_v2
  */
 function getPackageXmlV2($pfcontents)
 {
     require_once 'PEAR/PackageFile.php';
     require_once 'PEAR/Config.php';
     $config = PEAR_Config::singleton();
     $pkg = new PEAR_PackageFile($config, false, PEAR_TMPDIR);
     PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
     $pf = $pkg->fromXmlString($pfcontents, PEAR_VALIDATE_DOWNLOADING, 'package.xml');
     PEAR::popErrorHandling();
     if (PEAR::isError($pf)) {
         return $pf;
     }
     if ($pf->getPackagexmlVersion() != '1.0') {
         $pf2 = new PEAR_PackageFile_v2_rw();
         $pf2->fromArray($pf->getArray());
     } else {
         require_once 'PEAR/PackageFile/Generator/v1.php';
         $gen = new PEAR_PackageFile_Generator_v1($pf);
         $pf2 = $gen->toV2('PEAR_PackageFile_v2_rw');
     }
     require_once 'pear-database-package.php';
     $info = package::info($pf2->getPackage());
     $pf2->setPackage($this->_package);
     $pf2->setChannel('pear.php.net');
     $pf2->setSummary($info['summary']);
     $pf2->setDescription($info['description']);
     $m = $pf2->getMaintainers();
     foreach ($m as $maintainer) {
         $pf2->deleteMaintainer($maintainer['handle']);
     }
     $maintainers = package::info($this->_package, 'authors');
     foreach ($maintainers as $maintainer) {
         $pf2->addMaintainer($maintainer['role'], $maintainer['handle'], $maintainer['name'], $maintainer['email'], $maintainer['active'] ? 'yes' : 'no');
     }
     return $pf2;
 }