cellog Mon Apr 25 00:24:46 2005 EDT
Modified files:
/pear-core/PEAR/Command Remote.php
/pear-core/PEAR/REST 10.php
Log:
implement package.info in REST
http://cvs.php.net/diff.php/pear-core/PEAR/Command/Remote.php?r1=1.72&r2=1.73&ty=u
Index: pear-core/PEAR/Command/Remote.php
diff -u pear-core/PEAR/Command/Remote.php:1.72
pear-core/PEAR/Command/Remote.php:1.73
--- pear-core/PEAR/Command/Remote.php:1.72 Sun Apr 24 21:55:58 2005
+++ pear-core/PEAR/Command/Remote.php Mon Apr 25 00:24:45 2005
@@ -17,7 +17,7 @@
* @author Greg Beaver <cellog@xxxxxxx>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: Remote.php,v 1.72 2005/04/25 01:55:58 cellog Exp $
+ * @version CVS: $Id: Remote.php,v 1.73 2005/04/25 04:24:45 cellog Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*/
@@ -173,8 +173,14 @@
$channel = $parsed['channel'];
$this->config->set('default_channel', $channel);
$chan = $reg->getChannel($channel);
- $r = &$this->config->getRemote();
- $info = $r->call('package.info', $parsed['package']);
+ if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
+ $base = $chan->getBaseURL('REST1.0',
$this->config->get('preferred_mirror'))) {
+ $rest = &$this->config->getREST('1.0', array());
+ $info = $rest->packageInfo($base, $parsed['package']);
+ } else {
+ $r = &$this->config->getRemote();
+ $info = $r->call('package.info', $parsed['package']);
+ }
if (PEAR::isError($info)) {
$this->config->set('default_channel', $savechannel);
return $this->raiseError($info);
http://cvs.php.net/diff.php/pear-core/PEAR/REST/10.php?r1=1.4&r2=1.5&ty=u
Index: pear-core/PEAR/REST/10.php
diff -u pear-core/PEAR/REST/10.php:1.4 pear-core/PEAR/REST/10.php:1.5
--- pear-core/PEAR/REST/10.php:1.4 Mon Apr 25 00:03:04 2005
+++ pear-core/PEAR/REST/10.php Mon Apr 25 00:24:46 2005
@@ -15,7 +15,7 @@
* @author Greg Beaver <cellog@xxxxxxx>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: 10.php,v 1.4 2005/04/25 04:03:04 cellog Exp $
+ * @version CVS: $Id: 10.php,v 1.5 2005/04/25 04:24:46 cellog Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a12
*/
@@ -379,6 +379,49 @@
return $ret;
}
+ function packageInfo($base, $package)
+ {
+ PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
+ $info = $this->_rest->retrieveData($base . 'p/' . strtolower($package)
. '/info.xml');
+ $latest = $this->_rest->retrieveData($base . 'r/' .
strtolower($package) . '/latest.txt');
+ $d = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
'/deps.' .
+ $latest . '.txt');
+ PEAR::popErrorHandling();
+ if (PEAR::isError($info)) {
+ return PEAR::raiseError('Unknown package: "' . $package . '"');
+ }
+ if (PEAR::isError($latest)) {
+ return $latest;
+ }
+ if (PEAR::isError($d)) {
+ return $d;
+ }
+ $d = unserialize($d);
+ if (isset($d['required'])) {
+ require_once 'PEAR/PackageFile/v2.php';
+ $pf = new PEAR_PackageFile_v2;
+ $pf->setDeps($d);
+ $d = $pf->getDeps();
+ }
+ $deps = array();
+ foreach ($d as $dep) {
+ if ($dep['type'] != 'pkg') {
+ continue;
+ }
+ $deps[] = $dep;
+ }
+ return array(
+ 'name' => $info['n'],
+ 'channel' => $info['c'],
+ 'category' => $info['ca']['_content'],
+ 'stable' => $latest,
+ 'license' => $info['l'],
+ 'summary' => $info['s'],
+ 'description' => $info['d'],
+ 'deps' => $deps,
+ );
+ }
+
/**
* Return an array containing all of the states that are more stable than
* or equal to the passed in state
--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|