summaryrefslogtreecommitdiff
path: root/pear/PEAR
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-07-21 07:18:49 +0000
committerStig Bakken <ssb@php.net>2002-07-21 07:18:49 +0000
commit783410e2bdfcd867c7c113c29dae909b6db94b06 (patch)
tree0e9eade6f157dba782697ad6f9838c4be9fcaaf6 /pear/PEAR
parent03b116017375bcb102be4aa2282c05ad004b6c66 (diff)
downloadphp-git-783410e2bdfcd867c7c113c29dae909b6db94b06.tar.gz
* support "zend" dependency type
Diffstat (limited to 'pear/PEAR')
-rw-r--r--pear/PEAR/Dependency.php42
1 files changed, 31 insertions, 11 deletions
diff --git a/pear/PEAR/Dependency.php b/pear/PEAR/Dependency.php
index 53b32c67e2..15ffa9f157 100644
--- a/pear/PEAR/Dependency.php
+++ b/pear/PEAR/Dependency.php
@@ -48,12 +48,7 @@ class PEAR_Dependency
function callCheckMethod($opts)
{
$rel = isset($opts['rel']) ? $opts['rel'] : 'has';
- if (isset($opts['version'])) {
- $req = $opts['version'];
- $rel = 'v.' . $rel;
- } else {
- $req = null;
- }
+ $req = isset($opts['version']) ? $opts['version'] : null;
$name = isset($opts['name']) ? $opts['name'] : null;
switch ($opts['type']) {
case 'pkg':
@@ -74,6 +69,9 @@ class PEAR_Dependency
case 'sapi':
return $this->checkSAPI($name);
break;
+ case 'zend':
+ return $this->checkZend($name);
+ break;
default:
return "'{$opts['type']}' dependency type not supported";
}
@@ -90,7 +88,7 @@ class PEAR_Dependency
*/
function checkPackage($name, $req = null, $relation = 'has')
{
- if (substr($relation, 0, 2) == "v.") {
+ if (substr($relation, 0, 2) == 'v.') {
$relation = substr($relation, 2);
}
switch ($relation) {
@@ -179,7 +177,7 @@ class PEAR_Dependency
*
* @return mixed bool false if no error or the error string
*/
- function checkPHP($req, $relation = 'v.ge')
+ function checkPHP($req, $relation = 'ge')
{
if (substr($relation, 0, 2) == 'v.') {
$php_ver = phpversion();
@@ -239,10 +237,32 @@ class PEAR_Dependency
return "'$sapi_backend' SAPI backend not supported";
}
+
/**
- * Converts text comparing operators to them sign equivalents
- * ex: 'ge' to '>='
- */
+ * Zend version check method
+ *
+ * @param string $req which version to compare
+ * @param string $relation how to compare the version
+ *
+ * @return mixed bool false if no error or the error string
+ */
+ function checkZend($req, $relation = 'ge')
+ {
+ if (substr($relation, 0, 2) == 'v.') {
+ $zend_ver = zend_version();
+ $operator = substr($relation, 2);
+ if (!version_compare("$zend_ver", "$req", $operator)) {
+ return "Zend version " . $this->signOperator($operator) .
+ " $req is required";
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Converts text comparing operators to them sign equivalents
+ * ex: 'ge' to '>='
+ */
function signOperator($operator)
{
switch($operator) {