Progress: here's the short script to add packagexml info
| From: | greg at chiaraquartet dot net | Date: | Fri, 24 Dec 2004 18:41:04 +0000 |
| Subject: | Progress: here's the short script to add packagexml info | ||
| Groups: | php.pear.webmaster | ||
| Request: | Send a blank email to pear-webmaster+get-3633@lists.php.net to get a copy of this message | ||
Hi Martin,
I realized that tracking the package.xml contents makes more sense in the files
table than it does in the releases table. Of course, tracking package.xml will
make it much simpler to retrieve portions of the package.xml without having to
create a whole mess of unnecessary database tables, and make supporting
package.xml 2.0 a piece of cake.
After running this query:
ALTER TABLE files ADD packagexml TEXT NOT NULL DEFAULT "";
If you run this file at pearweb:
<?php
require_once 'DB.php';
require_once 'Archive/Tar.php';
$dbh = &DB::connect('mysql://pear:pear@localhost/pear');
$rows = $dbh->getAssoc('SELECT fullpath, release, id FROM files', false,
null, DB_FETCHMODE_ASSOC);
foreach ($rows as $file => $info) {
$tar = &new Archive_Tar($file);
if ($packagexml = $tar->extractInString('package.xml')) {
$dbh->query('UPDATE files SET packagexml = ? WHERE release ? AND ' .
'id = ?', array($packagexml, $info['release'],
$info['id']));
}
}
?>
That will set everything up. There's no rush - I won't be able to update
release-upload.php until I return to New York on Dec. 28.
Oh, and Merry Christmas :).
Greg