cvs: pearweb /include pear-rest.php
| From: | Greg Beaver | Date: | Fri, 21 Oct 2005 05:35:09 +0000 |
| Subject: | cvs: pearweb /include pear-rest.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-35752@lists.php.net to get a copy of this message | ||
cellog Fri Oct 21 01:35:09 2005 EDT
Modified files:
/pearweb/include pear-rest.php
Log:
add command to generate packagesinfo.xml in category directory
This is not ever called by live code, and so is present for testing purposes until
it is proven to be useable
http://cvs.php.net/diff.php/pearweb/include/pear-rest.php?r1=1.22&r2=1.23&ty=u
Index: pearweb/include/pear-rest.php
diff -u pearweb/include/pear-rest.php:1.22 pearweb/include/pear-rest.php:1.23
--- pearweb/include/pear-rest.php:1.22 Sun Sep 25 00:51:44 2005
+++ pearweb/include/pear-rest.php Fri Oct 21 01:35:08 2005
@@ -65,6 +65,57 @@
DIRECTORY_SEPARATOR . 'packages.xml', 0666);
}
+ function savePackagesCategoryREST($category)
+ {
+ $cdir = $this->_restdir . DIRECTORY_SEPARATOR . 'c';
+ if (!is_dir($cdir)) {
+ return;
+ }
+ $pdir = $this->_restdir . DIRECTORY_SEPARATOR . 'p';
+ $rdir = $this->_restdir . DIRECTORY_SEPARATOR . 'r';
+ $packages = category::listPackages($category);
+ $fullpackageinfo = '<f>
+';
+ foreach ($packages as $package) {
+ if (!file_exists($pdir . DIRECTORY_SEPARATOR . strtolower($package['name']) .
+ DIRECTORY_SEPARATOR . 'info.xml')) {
+ continue;
+ }
+ $fullpackageinfo .= '<pi>
+';
+ $fullpackageinfo .= str_replace(
+ '<?xml version="1.0" encoding="UTF-8" ?>
+<p xmlns="http://pear.php.net/dtd/rest.package"
+ xsi:schemaLocation="http://pear.php.net/dtd/rest.package
+ http://pear.php.net/dtd/rest.package.xsd">',
'<p>',
+ file_get_contents($pdir . DIRECTORY_SEPARATOR .
strtolower($package['name']) .
+ DIRECTORY_SEPARATOR . 'info.xml'));
+ if (file_exists($rdir . DIRECTORY_SEPARATOR . strtolower($package['name']) .
+ DIRECTORY_SEPARATOR . 'allreleases.xml')) {
+ $fullpackageinfo .= str_replace(
+ '<?xml version="1.0" encoding="UTF-8" ?>
+<a xmlns="http://pear.php.net/dtd/rest.allreleases"
+ xsi:schemaLocation="http://pear.php.net/dtd/rest.allreleases
+ http://pear.php.net/dtd/rest.allreleases.xsd">
+ <p>' . $package['name'] . '</p>
+ <c>' . PEAR_CHANNELNAME . '</c>', '
+ <a>
+ ',
+ file_get_contents($rdir . DIRECTORY_SEPARATOR .
+ strtolower($package['name']) . DIRECTORY_SEPARATOR .
+ 'allreleases.xml'));
+ }
+ $fullpackageinfo .= '</pi>
+';
+ }
+ $fullpackageinfo .= '</f>';
+ // list packages in a category
+ file_put_contents($cdir . DIRECTORY_SEPARATOR . urlencode($category) .
+ DIRECTORY_SEPARATOR . 'packagesinfo.xml', $fullpackageinfo);
+ @chmod($cdir . DIRECTORY_SEPARATOR . urlencode($category) .
+ DIRECTORY_SEPARATOR . 'packagesinfo.xml', 0666);
+ }
+
function deleteCategoryREST($category)
{
require_once 'System.php';