Re: PEAR 1.4.0dev3 is available

From: Date: Sun, 30 May 2004 19:38:17 +0000
Subject: Re: PEAR 1.4.0dev3 is available
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29806@lists.php.net to get a copy of this message
On Sun, 30 May 2004, Mika Tuupola wrote: > Anyway, does anyone on the list info on how the new package.xml > with channels should look like. Running the following script: I guess I figured it out. The example script did not initialize PEAR_Registry object for PEAR_PackageFile. Also setPackagexmlVersion('1.1') does not seem to work. If the original package.xml has <package version="1.0"> the output will also have 1.0 regardless the setPackagexmlVersion('1.1'). If I am correct the only needed changes to package.xml to have channels support are the following: 1) package must have attribute 'version' with value 1.1 <package version="1.0"> 2) name must have attribute 'channel' with desired channel name <name channel="channelname">Foo_Bar</name> Below is a working version of the example conversion script. However atleast in my case i had to have <package version="1.1"> already in the package.xml for it to do anything (basically adds the default channel 'pear' to the name tag. Creg correct me if I'm wrong). -cut- <?php require_once 'PEAR/Common.php'; require_once 'PEAR/PackageFile.php'; require_once 'PEAR/Registry.php'; $pr = new Pear_Registry(); $pc = new PEAR_PackageFile(); $pc->setRegistry($pr); $err = $pc->fromPackageFile('package.xml'); if (PEAR::isError($err)) { die($err->getMessage()); } foreach ($pc->getErrors(true) as $error) { echo ucfirst($error['level']) . ': ' . $error['message'] . "\n"; } if (!$err) { die('Validation failed'); } $pc->setPackagexmlVersion('1.1'); // does not work? print $pc->toXML(); ?> -cut- -- Mika Tuupola http://www.appelsiini.net/~tuupola/

« previous php.pear.dev (#29806) next »