From: Greg Beaver Date: Wed, 13 Aug 2003 21:12:15 +0000 (+0000) Subject: fix optional dependencies in reading, validating, and writing of package.xml X-Git-Tag: RELEASE_0_7~676 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7a70ccc132d013c6db4f5f6b2030b675070b5ae;p=php fix optional dependencies in reading, validating, and writing of package.xml --- diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php index 81f88b6643..4f511a337c 100644 --- a/pear/PEAR/Common.php +++ b/pear/PEAR/Common.php @@ -924,6 +924,9 @@ class PEAR_Common extends PEAR if (isset($dep['version'])) { $ret .= " version=\"$dep[version]\""; } + if (isset($dep['optional'])) { + $ret .= " optional=\"$dep[optional]\""; + } if (isset($dep['name'])) { $ret .= ">$dep[name]\n"; } else { @@ -1090,6 +1093,11 @@ class PEAR_Common extends PEAR } elseif (!in_array($d['rel'], $_PEAR_Common_dependency_relations)) { $errors[] = "dependency $i: invalid relation, should be one of: ".implode(' ', $_PEAR_Common_dependency_relations); } + if (!empty($d['optional'])) { + if (!in_array($d['optional'], array('yes', 'no'))) { + $errors[] = "dependency $i: invalid relation optional attribute, should be one of: yes no"; + } + } if ($d['rel'] != 'has' && empty($d['version'])) { $warnings[] = "dependency $i: missing version"; } elseif ($d['rel'] == 'has' && !empty($d['version'])) {