<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>PEAR_Server</tt></b> on <span id="info">MAIN</span></td></tr>
<tr><td><tt><a href="#file1">package.xml</a></tt></td><td align="right" id="added">+5</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/package.xml?r=1.24">1.24</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/package.xml?r1=1.24&r2=1.25">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/package.xml?r=1.25">1.25</a></td></tr>
<tr class="alt"><td><tt><a href="#file2">package.xml</a></tt></td><td align="right" id="added">+5</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/package.xml?r=1.24">1.24</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/package.xml?r1=1.24&r2=1.25">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/package.xml?r=1.25">1.25</a></td></tr>
<tr><td><tt>Server/<a href="#file3">Backend.php</a></tt></td><td align="right" id="added">+10</td><td></td><td nowrap="nowrap" align="center"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend.php?r=1.6">1.6</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Backend.php?r1=1.6&r2=1.7">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend.php?r=1.7">1.7</a></td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file4">Exception.php</a></tt></td><td align="right" id="added">+15</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Exception.php?r=1.5">1.5</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Exception.php?r1=1.5&r2=1.6">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Exception.php?r=1.6">1.6</a></td></tr>
<tr><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file5">Backend.php</a></tt></td><td align="right" id="added">+10</td><td></td><td nowrap="nowrap" align="center"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend.php?r=1.6">1.6</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Backend.php?r1=1.6&r2=1.7">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend.php?r=1.7">1.7</a></td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file6">Exception.php</a></tt></td><td align="right" id="added">+15</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Exception.php?r=1.5">1.5</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Exception.php?r1=1.5&r2=1.6">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Exception.php?r=1.6">1.6</a></td></tr>
<tr><td><tt>Server/Backend/<a href="#file7">DBDataObject.php</a></tt></td><td align="right" id="added">+149</td><td align="right" id="removed">-35</td><td nowrap="nowrap" align="center"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend/DBDataObject.php?r=1.21">1.21</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Backend/DBDataObject.php?r1=1.21&r2=1.22">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend/DBDataObject.php?r=1.22">1.22</a></td></tr>
<tr><td></td><td align="right" id="added">+209</td><td align="right" id="removed">-45</td><td></td></tr>
</table>
<small id="info">7 modified files</small><br />
<pre class="comment">
fully implement all REST support, including deletion
of rest stuff to match deletion from the database
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server">PEAR_Server</a><br /></span>
<div class="fileheader"><big><b>package.xml</b></big> <small id="info"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/package.xml?r=1.24">1.24</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/package.xml?r1=1.24&r2=1.25">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/package.xml?r=1.25">1.25</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.24 -r1.25
--- package.xml        20 Apr 2005 04:06:18 -0000        1.24
+++ package.xml        21 Apr 2005 03:39:49 -0000        1.25
@@ -26,7 +26,7 @@
</small></pre><pre class="diff" id="context">   &lt;email&gt;davey@php.net&lt;/email&gt;
   &lt;active&gt;yes&lt;/active&gt;
  &lt;/lead&gt;
</pre><pre class="diff" id="removed">- &lt;date&gt;2005-04-<span id="removedchars">18</span>&lt;/date&gt;
</pre><pre class="diff" id="added">+ &lt;date&gt;2005-04-<span id="addedchars">20</span>&lt;/date&gt;
</pre><pre class="diff" id="context">  &lt;version&gt;
   &lt;release&gt;0.18.0&lt;/release&gt;
   &lt;api&gt;0.18.0&lt;/api&gt;
</pre><pre class="diff"><small id="info">@@ -39,6 +39,8 @@
</small></pre><pre class="diff" id="context">  &lt;notes&gt;
     Implement REST support
     fix subpackage support
</pre><pre class="diff" id="added">+    fix package.info
+    fix PHP5 issue with visibility of Xmlrpc5 server contructor
</pre><pre class="diff" id="context">  &lt;/notes&gt;
  &lt;contents&gt;
   &lt;dir name="/" baseinstalldir="Chiara/PEAR"&gt;
</pre><pre class="diff"><small id="info">@@ -581,6 +583,8 @@
</small></pre><pre class="diff" id="context">    &lt;notes&gt;
     Implement REST support
     fix subpackage support
</pre><pre class="diff" id="added">+    fix package.info
+    fix PHP5 issue with visibility of Xmlrpc5 server contructor
</pre><pre class="diff" id="context">    &lt;/notes&gt;
   &lt;/release&gt;
  &lt;/changelog&gt;
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname"><a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server">PEAR_Server</a><br /></span>
<div class="fileheader"><big><b>package.xml</b></big> <small id="info"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/package.xml?r=1.24">1.24</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/package.xml?r1=1.24&r2=1.25">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/package.xml?r=1.25">1.25</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.24 -r1.25
--- package.xml        20 Apr 2005 04:06:18 -0000        1.24
+++ package.xml        21 Apr 2005 03:39:49 -0000        1.25
@@ -26,7 +26,7 @@
</small></pre><pre class="diff" id="context">   &lt;email&gt;davey@php.net&lt;/email&gt;
   &lt;active&gt;yes&lt;/active&gt;
  &lt;/lead&gt;
</pre><pre class="diff" id="removed">- &lt;date&gt;2005-04-<span id="removedchars">18</span>&lt;/date&gt;
</pre><pre class="diff" id="added">+ &lt;date&gt;2005-04-<span id="addedchars">20</span>&lt;/date&gt;
</pre><pre class="diff" id="context">  &lt;version&gt;
   &lt;release&gt;0.18.0&lt;/release&gt;
   &lt;api&gt;0.18.0&lt;/api&gt;
</pre><pre class="diff"><small id="info">@@ -39,6 +39,8 @@
</small></pre><pre class="diff" id="context">  &lt;notes&gt;
     Implement REST support
     fix subpackage support
</pre><pre class="diff" id="added">+    fix package.info
+    fix PHP5 issue with visibility of Xmlrpc5 server contructor
</pre><pre class="diff" id="context">  &lt;/notes&gt;
  &lt;contents&gt;
   &lt;dir name="/" baseinstalldir="Chiara/PEAR"&gt;
</pre><pre class="diff"><small id="info">@@ -581,6 +583,8 @@
</small></pre><pre class="diff" id="context">    &lt;notes&gt;
     Implement REST support
     fix subpackage support
</pre><pre class="diff" id="added">+    fix package.info
+    fix PHP5 issue with visibility of Xmlrpc5 server contructor
</pre><pre class="diff" id="context">    &lt;/notes&gt;
   &lt;/release&gt;
  &lt;/changelog&gt;
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname"><a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server">PEAR_Server</a>/<a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server/Server">Server</a><br /></span>
<div class="fileheader"><big><b>Backend.php</b></big> <small id="info"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend.php?r=1.6">1.6</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Backend.php?r1=1.6&r2=1.7">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend.php?r=1.7">1.7</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.6 -r1.7
--- Backend.php        19 Apr 2005 04:04:26 -0000        1.6
+++ Backend.php        21 Apr 2005 03:39:50 -0000        1.7
@@ -26,12 +26,20 @@
</small></pre><pre class="diff" id="context"> 
     abstract public function saveReleaseREST($package, $version);
 
</pre><pre class="diff" id="added">+    abstract public function saveAllReleasesREST($package);
+
</pre><pre class="diff" id="context">     abstract public function savePackageREST($package);
 
</pre><pre class="diff" id="added">+    abstract public function deletePackageREST($package);
+
</pre><pre class="diff" id="context">     abstract public function saveCategoryREST($category);
 
</pre><pre class="diff" id="added">+    abstract public function deleteCategoryREST($category);
+
</pre><pre class="diff" id="context">     abstract public function deleteRelease($packagename, $version);
 
</pre><pre class="diff" id="added">+    abstract public function deleteReleaseREST($packagename, $version);
+
</pre><pre class="diff" id="context">     abstract public function getReleasePath($packagename, $version);
 
     /**
</pre><pre class="diff"><small id="info">@@ -87,6 +95,8 @@
</small></pre><pre class="diff" id="context">      */
     abstract public function addPackage($package);
 
</pre><pre class="diff" id="added">+    abstract public function deletePackage($packagename, $category);
+
</pre><pre class="diff" id="context">     /**
      * @param Chiara_PEAR_Server_Package
      */
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname"><a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server">PEAR_Server</a>/<a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server/Server">Server</a><br /></span>
<div class="fileheader"><big><b>Exception.php</b></big> <small id="info"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Exception.php?r=1.5">1.5</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Exception.php?r1=1.5&r2=1.6">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Exception.php?r=1.6">1.6</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.5 -r1.6
--- Exception.php        19 Apr 2005 04:04:26 -0000        1.5
+++ Exception.php        21 Apr 2005 03:39:50 -0000        1.6
@@ -226,12 +226,12 @@
</small></pre><pre class="diff" id="context"> 
 class Chiara_PEAR_Server_ExceptionInvalidRelease extends Chiara_PEAR_Server_Exception
 {
</pre><pre class="diff" id="removed">-    protected $_message = 'Invalid release uploaded';
</pre><pre class="diff" id="added">+    protected $_message = 'Invalid release uploaded<span id="addedchars">:&nbsp;"%info%"</span>';
</pre><pre class="diff" id="context"> 
     public function __construct($packagefile, $msg = false)
     {
</pre><pre class="diff" id="removed">-        $this-&gt;_data = array();
-        parent::__construct($msg ? $msg : $this-&gt;_message, $packagefile-&gt;getUserInfo());
</pre><pre class="diff" id="added">+        $this-&gt;_data = array('info' =&gt; $packagefile-&gt;getUserInfo());
+        parent::__construct($msg ? $msg : $this-&gt;_message);
</pre><pre class="diff" id="context">     }
 }
 
</pre><pre class="diff"><small id="info">@@ -242,7 +242,18 @@
</small></pre><pre class="diff" id="context">     public function __construct($package, $version, $msg = false)
     {
         $this-&gt;_data = array('p' =&gt; $package, 'v' =&gt; $version);
</pre><pre class="diff" id="removed">-        parent::__construct($msg ? $msg : $this-&gt;_message<span id="removedchars">,&nbsp;$packagefile-&gt;getUserInfo()</span>);
</pre><pre class="diff" id="added">+        parent::__construct($msg ? $msg : $this-&gt;_message);
+    }
+}
+
+class Chiara_PEAR_Server_ExceptionCannotDeleteHasReleases extends Chiara_PEAR_Server_Exception
+{
+    protected $_message = 'Package %p% in channel %c cannot be deleted, delete all releases first';
+
+    public function __construct($package, $channel)
+    {
+        $this-&gt;_data = array('p' =&gt; $package, 'c' =&gt; $channel);
+        parent::__construct($msg ? $msg : $this-&gt;_message);
</pre><pre class="diff" id="context">     }
 }
 ?&gt;
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file5" /><div class="file">
<span class="pathname"><a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server">PEAR_Server</a>/<a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server/Server">Server</a><br /></span>
<div class="fileheader"><big><b>Backend.php</b></big> <small id="info"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend.php?r=1.6">1.6</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Backend.php?r1=1.6&r2=1.7">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend.php?r=1.7">1.7</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.6 -r1.7
--- Backend.php        19 Apr 2005 04:04:26 -0000        1.6
+++ Backend.php        21 Apr 2005 03:39:50 -0000        1.7
@@ -26,12 +26,20 @@
</small></pre><pre class="diff" id="context"> 
     abstract public function saveReleaseREST($package, $version);
 
</pre><pre class="diff" id="added">+    abstract public function saveAllReleasesREST($package);
+
</pre><pre class="diff" id="context">     abstract public function savePackageREST($package);
 
</pre><pre class="diff" id="added">+    abstract public function deletePackageREST($package);
+
</pre><pre class="diff" id="context">     abstract public function saveCategoryREST($category);
 
</pre><pre class="diff" id="added">+    abstract public function deleteCategoryREST($category);
+
</pre><pre class="diff" id="context">     abstract public function deleteRelease($packagename, $version);
 
</pre><pre class="diff" id="added">+    abstract public function deleteReleaseREST($packagename, $version);
+
</pre><pre class="diff" id="context">     abstract public function getReleasePath($packagename, $version);
 
     /**
</pre><pre class="diff"><small id="info">@@ -87,6 +95,8 @@
</small></pre><pre class="diff" id="context">      */
     abstract public function addPackage($package);
 
</pre><pre class="diff" id="added">+    abstract public function deletePackage($packagename, $category);
+
</pre><pre class="diff" id="context">     /**
      * @param Chiara_PEAR_Server_Package
      */
</pre></div>
<hr /><a name="file6" /><div class="file">
<span class="pathname"><a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server">PEAR_Server</a>/<a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server/Server">Server</a><br /></span>
<div class="fileheader"><big><b>Exception.php</b></big> <small id="info"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Exception.php?r=1.5">1.5</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Exception.php?r1=1.5&r2=1.6">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Exception.php?r=1.6">1.6</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.5 -r1.6
--- Exception.php        19 Apr 2005 04:04:26 -0000        1.5
+++ Exception.php        21 Apr 2005 03:39:50 -0000        1.6
@@ -226,12 +226,12 @@
</small></pre><pre class="diff" id="context"> 
 class Chiara_PEAR_Server_ExceptionInvalidRelease extends Chiara_PEAR_Server_Exception
 {
</pre><pre class="diff" id="removed">-    protected $_message = 'Invalid release uploaded';
</pre><pre class="diff" id="added">+    protected $_message = 'Invalid release uploaded<span id="addedchars">:&nbsp;"%info%"</span>';
</pre><pre class="diff" id="context"> 
     public function __construct($packagefile, $msg = false)
     {
</pre><pre class="diff" id="removed">-        $this-&gt;_data = array();
-        parent::__construct($msg ? $msg : $this-&gt;_message, $packagefile-&gt;getUserInfo());
</pre><pre class="diff" id="added">+        $this-&gt;_data = array('info' =&gt; $packagefile-&gt;getUserInfo());
+        parent::__construct($msg ? $msg : $this-&gt;_message);
</pre><pre class="diff" id="context">     }
 }
 
</pre><pre class="diff"><small id="info">@@ -242,7 +242,18 @@
</small></pre><pre class="diff" id="context">     public function __construct($package, $version, $msg = false)
     {
         $this-&gt;_data = array('p' =&gt; $package, 'v' =&gt; $version);
</pre><pre class="diff" id="removed">-        parent::__construct($msg ? $msg : $this-&gt;_message<span id="removedchars">,&nbsp;$packagefile-&gt;getUserInfo()</span>);
</pre><pre class="diff" id="added">+        parent::__construct($msg ? $msg : $this-&gt;_message);
+    }
+}
+
+class Chiara_PEAR_Server_ExceptionCannotDeleteHasReleases extends Chiara_PEAR_Server_Exception
+{
+    protected $_message = 'Package %p% in channel %c cannot be deleted, delete all releases first';
+
+    public function __construct($package, $channel)
+    {
+        $this-&gt;_data = array('p' =&gt; $package, 'c' =&gt; $channel);
+        parent::__construct($msg ? $msg : $this-&gt;_message);
</pre><pre class="diff" id="context">     }
 }
 ?&gt;
</pre><pre class="diff"><small id="info">\ No newline at end of file
</small></pre></div>
<hr /><a name="file7" /><div class="file">
<span class="pathname"><a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server">PEAR_Server</a>/<a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server/Server">Server</a>/<a href="http://cvs.phpdoc.org/cvs.php/PEAR_Server/Server/Backend">Backend</a><br /></span>
<div class="fileheader"><big><b>DBDataObject.php</b></big> <small id="info"><a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend/DBDataObject.php?r=1.21">1.21</a> <a href="http://cvs.phpdoc.org/diff.php/PEAR_Server/Server/Backend/DBDataObject.php?r1=1.21&r2=1.22">-&gt;</a> <a href="http://cvs.phpdoc.org/co.php/PEAR_Server/Server/Backend/DBDataObject.php?r=1.22">1.22</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.21 -r1.22
--- DBDataObject.php        20 Apr 2005 23:30:22 -0000        1.21
+++ DBDataObject.php        21 Apr 2005 03:39:50 -0000        1.22
@@ -96,7 +96,11 @@
</small></pre><pre class="diff" id="context">         if (!$releases-&gt;find()) {
             return false;
         }
</pre><pre class="diff" id="removed">-        return $releases-&gt;delete() !== false;
</pre><pre class="diff" id="added">+        $ret = ($releases-&gt;delete() !== false);
+        if ($ret) {
+            $this-&gt;deleteReleaseREST($packagename, $version);
+        }
+        return $ret;
</pre><pre class="diff" id="context">     }
 
     public function saveRelease(Chiara_PEAR_Server_Release $release)
</pre><pre class="diff"><small id="info">@@ -192,14 +196,27 @@
</small></pre><pre class="diff" id="context">             $releasedata = DB_DataObject::factory('releases');
             $releasedata-&gt;channel = $this-&gt;_channel;
             $releasedata-&gt;package = $package;
</pre><pre class="diff" id="added">+            $releasedata-&gt;orderby('releasedate');
</pre><pre class="diff" id="context">             if (!$releasedata-&gt;find(false)) {
</pre><pre class="diff" id="removed">-                throw new Chiara_PEAR_Server_ExceptionPackageDoesntExist($package, $this-&gt;_channel);
</pre><pre class="diff" id="added">+                return;
</pre><pre class="diff" id="context">             }
             $info = '&lt;a&gt;
  &lt;p&gt;' . $package . '&lt;/p&gt;
  &lt;c&gt;' . $this-&gt;_channel . '&lt;/c&gt;
 ';
             while ($releasedata-&gt;fetch()) {
</pre><pre class="diff" id="added">+                if (!isset($latest)) {
+                    $latest = $releasedata-&gt;version;
+                }
+                if ($releasedata-&gt;state == 'stable' &amp;&amp; !isset($stable)) {
+                    $stable = $releasedata-&gt;version;
+                }
+                if ($releasedata-&gt;state == 'beta' &amp;&amp; !isset($beta)) {
+                    $beta = $releasedata-&gt;version;
+                }
+                if ($releasedata-&gt;state == 'alpha' &amp;&amp; !isset($alpha)) {
+                    $alpha = $releasedata-&gt;version;
+                }
</pre><pre class="diff" id="context">                 $info .= ' &lt;r&gt;&lt;v&gt;' . $releasedata-&gt;version . '&lt;/v&gt;&lt;s&gt;' . $releasedata-&gt;state . '&lt;/s&gt;&lt;/r&gt;
 ';
             }
</pre><pre class="diff"><small id="info">@@ -209,10 +226,56 @@
</small></pre><pre class="diff" id="context">                 System::mkdir(array('-p', $rdir . DIRECTORY_SEPARATOR . $package));
                 @chmod($rdir . DIRECTORY_SEPARATOR . $package, 0777);
             }
</pre><pre class="diff" id="removed">-            file_put_contents($rdir . DIRECTORY_SEPARATOR . $<span id="removedchars">release['package']</span> .
</pre><pre class="diff" id="added">+            file_put_contents($rdir . DIRECTORY_SEPARATOR . $<span id="addedchars">package</span> .
</pre><pre class="diff" id="context">                 DIRECTORY_SEPARATOR . 'allreleases.xml', $info);
</pre><pre class="diff" id="removed">-            @chmod($rdir . DIRECTORY_SEPARATOR . $<span id="removedchars">release['package']</span> .
</pre><pre class="diff" id="added">+            @chmod($rdir . DIRECTORY_SEPARATOR . $<span id="addedchars">package</span> .
</pre><pre class="diff" id="context">                 DIRECTORY_SEPARATOR . 'allreleases.xml', 0666);
</pre><pre class="diff" id="added">+
+            file_put_contents($rdir . DIRECTORY_SEPARATOR . $package .
+                DIRECTORY_SEPARATOR . 'latest.txt', $version);
+            @chmod($rdir . DIRECTORY_SEPARATOR . $package .
+                DIRECTORY_SEPARATOR . 'latest.txt', 0666);
+            if (isset($stable)) {
+                file_put_contents($rdir . DIRECTORY_SEPARATOR . $package .
+                    DIRECTORY_SEPARATOR . 'stable.txt', $stable);
+                @chmod($rdir . DIRECTORY_SEPARATOR . $package .
+                    DIRECTORY_SEPARATOR . 'stable.txt', 0666);
+            }
+            if (isset($beta)) {
+                file_put_contents($rdir . DIRECTORY_SEPARATOR . $package .
+                    DIRECTORY_SEPARATOR . 'beta.txt', $beta);
+                @chmod($rdir . DIRECTORY_SEPARATOR . $package .
+                    DIRECTORY_SEPARATOR . 'beta.txt', 0666);
+            }
+            if (isset($alpha)) {
+                file_put_contents($rdir . DIRECTORY_SEPARATOR . $package .
+                    DIRECTORY_SEPARATOR . 'alpha.txt', $alpha);
+                @chmod($rdir . DIRECTORY_SEPARATOR . $package .
+                    DIRECTORY_SEPARATOR . 'alpha.txt', 0666);
+            }
+        }
+    }
+
+    public function deleteReleaseREST($package, $version)
+    {
+        $channel = DB_DataObject::factory('channels');
+        $channel-&gt;channel = $this-&gt;_channel;
+        $channel-&gt;find(true);
+        if ($channel-&gt;rest_support) {
+            $channelinfo = parse_url($this-&gt;_channel);
+            if (isset($channelinfo['host'])) {
+                $extra = $channelinfo['path'] . '/Chiara_PEAR_Server_REST/';
+            } else {
+                $extra = '/Chiara_PEAR_Server_REST';
+            }
+            $rdir = $this-&gt;_restdir . DIRECTORY_SEPARATOR . 'r';
+            if (!file_exists($rdir . DIRECTORY_SEPARATOR . $package)) {
+                return;
+            }
+            @unlink($rdir . DIRECTORY_SEPARATOR . $version . '.xml');
+            @unlink($rdir . DIRECTORY_SEPARATOR . $package .
+                DIRECTORY_SEPARATOR . 'package.' . $version . '.xml');
+            $this-&gt;saveAllReleasesREST($package);
</pre><pre class="diff" id="context">         }
     }
 
</pre><pre class="diff"><small id="info">@@ -237,38 +300,11 @@
</small></pre><pre class="diff" id="context">             }
             $release = $releasedata-&gt;toArray();
             $rdir = $this-&gt;_restdir . DIRECTORY_SEPARATOR . 'r';
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context">             if (!file_exists($rdir . DIRECTORY_SEPARATOR . $package)) {
                 System::mkdir(array('-p', $rdir . DIRECTORY_SEPARATOR . $package));
                 @chmod($rdir . DIRECTORY_SEPARATOR . $package, 0777);
             }
</pre><pre class="diff" id="removed">-            if (@file_exists($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                  DIRECTORY_SEPARATOR . 'latest.txt')) {
-                $latest = file_get_contents($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                    DIRECTORY_SEPARATOR . 'latest.txt', $latest);
-                if (version_compare($latest, $version, '&lt;')) {
-                    file_put_contents($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                        DIRECTORY_SEPARATOR . 'latest.txt', $version);
-                }
-            } else {
-                file_put_contents($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                    DIRECTORY_SEPARATOR . 'latest.txt', $version);
-            }
-            @chmod($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                DIRECTORY_SEPARATOR . 'latest.txt', 0666);
-            if (@file_exists($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                  DIRECTORY_SEPARATOR . $release['state'] . '.txt')) {
-                $latest = file_get_contents($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                    DIRECTORY_SEPARATOR . $release['state'] . '.txt', $latest);
-                if (version_compare($latest, $version, '&lt;')) {
-                    file_put_contents($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                        DIRECTORY_SEPARATOR . $release['state'] . '.txt', $version);
-                }
-            } else {
-                file_put_contents($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                    DIRECTORY_SEPARATOR . $release['state'] . '.txt', $version);
-            }
-            @chmod($rdir . DIRECTORY_SEPARATOR . $release['package'] .
-                DIRECTORY_SEPARATOR . $release['state'] . '.txt', 0666);
</pre><pre class="diff" id="context"> 
             $info = '&lt;?xml version="1.0"?&gt;
 &lt;r&gt;
</pre><pre class="diff"><small id="info">@@ -290,7 +326,7 @@
</small></pre><pre class="diff" id="context">             file_put_contents($rdir . DIRECTORY_SEPARATOR . $release['package'] .
                 DIRECTORY_SEPARATOR . 'package.' .
                 $version . '.xml', $this-&gt;getPackageXml($release['package'], $version));
</pre><pre class="diff" id="removed">-            @chmod($rdir . DIRECTORY_SEPARATOR . $<span id="removedchars">packag</span>e['package'] .
</pre><pre class="diff" id="added">+            @chmod($rdir . DIRECTORY_SEPARATOR . $<span id="addedchars">releas</span>e['package'] .
</pre><pre class="diff" id="context">                 DIRECTORY_SEPARATOR . 'package.' . $version . '.xml', 0666);
         }
     }
</pre><pre class="diff"><small id="info">@@ -371,13 +407,20 @@
</small></pre><pre class="diff" id="context"> 
     public function deleteCategory($category)
     {
</pre><pre class="diff" id="added">+        if ($category == 'Default') {
+            return false;
+        }
</pre><pre class="diff" id="context">         $categories = DB_DataObject::factory('categories');
         $categories-&gt;name = $category;
         $categories-&gt;channel = $this-&gt;_channel;
         if (!$categories-&gt;find()) {
             throw new Chiara_PEAR_Server_ExceptionCategoryDoesntExist($category, $this-&gt;_channel);
         }
</pre><pre class="diff" id="removed">-        return $categories-&gt;delete() !== false;
</pre><pre class="diff" id="added">+        $ret = ($categories-&gt;delete() !== false);
+        if ($ret) {
+            $this-&gt;deleteCategoryREST($category);
+        }
+        return $ret;
</pre><pre class="diff" id="context">     }
 
     public function categoryFromId($id)
</pre><pre class="diff"><small id="info">@@ -468,6 +511,29 @@
</small></pre><pre class="diff" id="context">         return $ret;
     }
 
</pre><pre class="diff" id="added">+    public function deleteCategoryREST($category)
+    {
+        $channel = DB_DataObject::factory('channels');
+        $channel-&gt;channel = $this-&gt;_channel;
+        $channel-&gt;find(true);
+        if ($channel-&gt;rest_support) {
+            $channelinfo = parse_url($this-&gt;_channel);
+            if (isset($channelinfo['host'])) {
+                $extra = $channelinfo['path'] . '/Chiara_PEAR_Server_REST/';
+            } else {
+                $extra = '/Chiara_PEAR_Server_REST';
+            }
+            $cdir = $this-&gt;_restdir . DIRECTORY_SEPARATOR . 'c';
+            $category = $this-&gt;categoryInfo($category);
+            if (!file_exists($cdir . DIRECTORY_SEPARATOR . urlencode($category['name']))) {
+                return;
+            }
+            // remove all category info
+            System::rm(array('-r', $this-&gt;_restdir . DIRECTORY_SEPARATOR . 'c'
+                . DIRECTORY_SEPARATOR . urlencode($category['name'])));
+        }
+    }
+
</pre><pre class="diff" id="context">     public function saveCategoryREST($category)
     {
         $channel = DB_DataObject::factory('channels');
</pre><pre class="diff"><small id="info">@@ -509,11 +575,34 @@
</small></pre><pre class="diff" id="context">             // list packages in a category
             file_put_contents($cdir . DIRECTORY_SEPARATOR . urlencode($category['name']) .
                 DIRECTORY_SEPARATOR . 'packages.xml', $list);
</pre><pre class="diff" id="removed">-            @chmod($cdir . DIRECTORY_SEPARATOR . $category['name'] .
</pre><pre class="diff" id="added">+            @chmod($cdir . DIRECTORY_SEPARATOR . urlencode($category['name']) .
</pre><pre class="diff" id="context">                 DIRECTORY_SEPARATOR . 'packages.xml', 0666);
         }
     }
 
</pre><pre class="diff" id="added">+    public function deletePackageREST($package, $category)
+    {
+        $channel = DB_DataObject::factory('channels');
+        $channel-&gt;channel = $this-&gt;_channel;
+        $channel-&gt;find(true);
+        if ($channel-&gt;rest_support) {
+            $channelinfo = parse_url($this-&gt;_channel);
+            if (isset($channelinfo['host'])) {
+                $extra = $channelinfo['path'] . '/Chiara_PEAR_Server_REST/';
+            } else {
+                $extra = '/Chiara_PEAR_Server_REST';
+            }
+
+            // remove all package and release info for the package
+            System::rm(array('-r', $this-&gt;_restdir . DIRECTORY_SEPARATOR . 'p'
+                . DIRECTORY_SEPARATOR . $package));
+            System::rm(array('-r', $this-&gt;_restdir . DIRECTORY_SEPARATOR . 'r'
+                . DIRECTORY_SEPARATOR . $package));
+            // reset categories info
+            $this-&gt;saveCategoryREST($category);
+        }
+    }
+
</pre><pre class="diff" id="context">     public function savePackageREST($package)
     {
         $channel = DB_DataObject::factory('channels');
</pre><pre class="diff"><small id="info">@@ -648,6 +737,31 @@
</small></pre><pre class="diff" id="context">         return $ret;
     }
 
</pre><pre class="diff" id="added">+    public function deletePackage($packagename)
+    {
+        $packages = DB_DataObject::factory('packages');
+        $packages-&gt;channel = $this-&gt;_channel;
+        $packages-&gt;package = $packagename;
+        if (!$packages-&gt;find(true)) {
+            throw new Chiara_PEAR_Server_ExceptionPackageDoesntExist($package, $this-&gt;_channel);
+        }
+        $categories = DB_DataObject::factory('categories');
+        $categories-&gt;channel = $this-&gt;_channel;
+        $categories-&gt;id = $packages-&gt;category_id;
+        $categories-&gt;find(true);
+        $releases = DB_DataObject::factory('releases');
+        $releases-&gt;channel = $this-&gt;_channel;
+        $releases-&gt;package = $packagename;
+        if ($releases-&gt;find()) {
+            throw new Chiara_PEAR_Server_ExceptionCannotDeleteHasReleases($package, $this-&gt;_channel);
+        }
+        $ret = $packages-&gt;delete() !== false;
+        if ($ret) {
+            $this-&gt;deletePackageREST($packagename, $categories-&gt;name);
+        }
+        return $ret;
+    }
+
</pre><pre class="diff" id="context">     public function addPackage($pkg)
     {
         $package = DB_DataObject::factory('packages');
</pre></div>
</body></html><pre>