From 0b847d98d7ccebcd5f854a46a1d9d64c93840f7c Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Fri, 4 Jan 2002 04:44:09 +0000 Subject: [PATCH] Add optional debug to cmp_version_long() --- phpgwapi/inc/class.common.inc.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index eaa64504bc..3ffac60b6f 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -55,10 +55,10 @@ { ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str1,$regs); ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str2,$regs2); - //echo "$regs[0] - $regs2[0]"; + //echo "
$regs[0] - $regs2[0]"; for($i=1;$i<5;$i++) { - //echo "
$regs[$i] - $regs2[$i]"; + echo "
$i: $regs[$i] - $regs2[$i]"; if($regs2[$i] == $regs[$i]) { continue; @@ -81,27 +81,33 @@ @param $str1 @param $str2 */ - function cmp_version_long($str1,$str2) + function cmp_version_long($str1,$str2,$debug=False) { ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)\.([0-9]*)",$str1,$regs); ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)\.([0-9]*)",$str2,$regs2); - //echo "$regs[0] - $regs2[0]"; + if($debug) { echo "
$regs[0] - $regs2[0]"; } + for($i=1;$i<6;$i++) { - //echo "
$regs[$i] - $regs2[$i]"; + if($debug) { echo "
$i: $regs[$i] - $regs2[$i]"; } + if($regs2[$i] == $regs[$i]) { + if($debug) { echo ' are equal...'; } continue; } if($regs2[$i] > $regs[$i]) { + if($debug) { echo ', and a > b'; } return 1; } elseif($regs2[$i] < $regs[$i]) { + if($debug) { echo ', and a < b'; } return 0; } } + if($debug) { echo ' - all equal.'; } } // Convert an array into the format needed for the access column.