logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: pear-core /PEAR ChannelFile.php: msg#00162

Subject: cvs: pear-core /PEAR ChannelFile.php
cellog          Thu Apr 28 00:10:34 2005 EDT

  Modified files:              
    /pear-core/PEAR     ChannelFile.php 
  Log:
  fix up function processing/validation of REST
  
http://cvs.php.net/diff.php/pear-core/PEAR/ChannelFile.php?r1=1.61&r2=1.62&ty=u
Index: pear-core/PEAR/ChannelFile.php
diff -u pear-core/PEAR/ChannelFile.php:1.61 pear-core/PEAR/ChannelFile.php:1.62
--- pear-core/PEAR/ChannelFile.php:1.61 Sun Apr 24 16:37:08 2005
+++ pear-core/PEAR/ChannelFile.php      Thu Apr 28 00:10:34 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: ChannelFile.php,v 1.61 2005/04/24 20:37:08 cellog Exp 
$
+ * @version    CVS: $Id: ChannelFile.php,v 1.62 2005/04/28 04:10:34 cellog Exp 
$
  * @link       http://pear.php.net/package/PEAR
  * @since      File available since Release 1.4.0a1
  */
@@ -125,9 +125,9 @@
  */
 define('PEAR_CHANNELFILE_ERROR_NO_STATICVERSION', 34);
 /**
- * Error code when <function> contains no uri attribute in a <rest> protocol 
definition
+ * Error code when <baseurl> contains no type attribute in a <rest> protocol 
definition
  */
-define('PEAR_CHANNELFILE_ERROR_NORESTURI', 35);
+define('PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE', 35);
 /** 
  * Error code when a mirror is defined and the channel.xml represents the 
__uri pseudo-channel
  */
@@ -248,8 +248,8 @@
                     '%parent% %protocol% function has no version',
                 PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME =>
                     '%parent% %protocol% function has no name',
-                PEAR_CHANNELFILE_ERROR_NORESTURI =>
-                    '%parent% rest function has no uri',
+                PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE =>
+                    '%parent% rest baseurl has no type',
                 PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME =>
                     'Validation package has no name in <validatepackage> tag',
                 PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION =>
@@ -685,8 +685,8 @@
             $this->validateFunctions('soap', 
$info['servers']['primary']['soap']['function']);
         }
         if (isset($info['servers']['primary']['rest']) &&
-              isset($info['servers']['primary']['rest']['function'])) {
-            $this->validateFunctions('rest', 
$info['servers']['primary']['rest']['function']);
+              isset($info['servers']['primary']['rest']['baseurl'])) {
+            $this->validateFunctions('rest', 
$info['servers']['primary']['rest']['baseurl']);
         }
         if (isset($info['servers']['mirror'])) {
             if ($this->_channelInfo['name'] == '__uri') {
@@ -717,7 +717,7 @@
                         $mirror['attribs']['host']);
                 }
                 if (isset($mirror['rest'])) {
-                    $this->validateFunctions('rest', 
$mirror['rest']['function'],
+                    $this->validateFunctions('rest', 
$mirror['rest']['baseurl'],
                         $mirror['attribs']['host']);
                 }
             }
@@ -740,16 +740,17 @@
                 $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME,
                     array('parent' => $parent, 'protocol' => $protocol));
             }
-            if (!isset($function['attribs']['version']) ||
-                  empty($function['attribs']['version'])) {
-                
$this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION,
-                    array('parent' => $parent, 'protocol' => $protocol));
-            }
             if ($protocol == 'rest') {
-                if (!isset($function['attribs']['uri']) ||
-                      empty($function['attribs']['uri'])) {
-                    $this->_validateError(PEAR_CHANNELFILE_ERROR_NORESTURI,
-                        array('parent' => $parent));
+                if (!isset($function['attribs']['type']) ||
+                      empty($function['attribs']['type'])) {
+                    
$this->_validateError(PEAR_CHANNELFILE_ERROR_NO_BASEURLTYPE,
+                        array('parent' => $parent, 'protocol' => $protocol));
+                }
+            } else {
+                if (!isset($function['attribs']['version']) ||
+                      empty($function['attribs']['version'])) {
+                    
$this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION,
+                        array('parent' => $parent, 'protocol' => $protocol));
                 }
             }
         }
@@ -894,16 +895,21 @@
         if ($this->getName() == '__uri') {
             return false;
         }
+        if ($protocol == 'rest') {
+            $function = 'baseurl';
+        } else {
+            $function = 'function';
+        }
         if ($mirror) {
             if ($mir = $this->getMirror($mirror)) {
-                if (isset($mir[$protocol]['function'])) {
-                    return $mir[$protocol]['function'];
+                if (isset($mir[$protocol][$function])) {
+                    return $mir[$protocol][$function];
                 }
             }
             return false;
         }
-        if 
(isset($this->_channelInfo['servers']['primary'][$protocol]['function'])) {
-            return 
$this->_channelInfo['servers']['primary'][$protocol]['function'];
+        if 
(isset($this->_channelInfo['servers']['primary'][$protocol][$function])) {
+            return 
$this->_channelInfo['servers']['primary'][$protocol][$function];
         } else {
             return false;
         }

-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>