Fix version check and display

This commit is contained in:
Miles Lott 2002-02-17 15:34:13 +00:00
parent 0975a7736a
commit 6c8ce90ce0
2 changed files with 44 additions and 14 deletions

View File

@ -23,7 +23,7 @@
$GLOBALS['phpgw_info']['user']['apps']['admin']) ||
$GLOBALS['phpgw_info']['server']['checkappversions'] == 'All')
{
$_current = False;
$_current = array();
$app_name = $GLOBALS['phpgw_info']['flags']['currentapp'];
$GLOBALS['phpgw']->db->query("SELECT app_name,app_version FROM phpgw_applications WHERE app_name='$app_name' OR app_name='phpgwapi'",__LINE__,__FILE__);
while($GLOBALS['phpgw']->db->next_record())
@ -39,26 +39,31 @@
$_app_title = $setup_info[$app_name]['title'];
unset($setup_info);
if($app_name == 'phpgwapi')
/* echo '<br>' . $app_name . ',' . $_db_version . ',' . $_file_version; */
$test = $GLOBALS['phpgw']->common->cmp_version_long($_db_version,$_file_version);
if($test == '')
{
$api_str = '<br>' . lang('The API requires an upgrade');
}
/* echo $app_name . ',' . $_db_version . ',' . $_file_version; */
if(!$GLOBALS['phpgw']->common->cmp_version_long($_db_version,$_file_version))
{
$_current = True;
$_current[$app_name] = True;
if($app_name == 'phpgwapi')
{
$api_str = '<br>' . lang('The API is current');
}
}
else
{
if($app_name == 'phpgwapi')
{
$api_str = '<br>' . lang('The API requires an upgrade');
}
}
unset($test);
unset($_file_version);
unset($_app_title);
}
unset($_db_version);
unset($_versionfile);
}
if(!$_current)
if(!@isset($_current[$GLOBALS['phpgw_info']['flags']['currentapp']]))
{
echo '<center>';
echo $api_str;

View File

@ -55,24 +55,36 @@
{
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);
if($debug) { echo "<br>$regs[0] - $regs2[0]"; }
if($debug)
{
echo '<br>cmp_version(' . $str1 . ',' . $str2 . ')';
echo "<br>$regs[0] - $regs2[0]";
}
for($i=1;$i<5;$i++)
{
if($debug) { echo "<br>$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. Returning 1.'; }
return 1;
}
elseif($regs2[$i] < $regs[$i])
{
if($debug) { echo ', and a > b. Returning 0.'; }
return 0;
}
}
if($debug)
{
echo ' - all equal. Returning NULL.';
return '';
}
}
/*!
@ -86,7 +98,16 @@
{
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);
if($debug) { echo "<br>$regs[0] - $regs2[0]"; }
if($debug)
{
echo '<br>cmp_version_long(' . $str1 . ',' . $str2 . ')';
echo "<br>$regs[0] - $regs2[0]";
}
if(!$regs[0])
{
if($debug) { echo '<br>calling cmp_version(' . $str1 . ',' . $str2 . ')'; }
return $this->cmp_version($str1,$str2,$debug);
}
for($i=1;$i<6;$i++)
{
@ -99,16 +120,20 @@
}
if($regs2[$i] > $regs[$i])
{
if($debug) { echo ', and a > b'; }
if($debug) { echo ', and a < b. Returning 1.'; }
return 1;
}
elseif($regs2[$i] < $regs[$i])
{
if($debug) { echo ', and a < b'; }
if($debug) { echo ', and a > b. Returning 0.'; }
return 0;
}
}
if($debug) { echo ' - all equal.'; }
if($debug)
{
echo ' - all equal. Returning NULL.';
return '';
}
}
// Convert an array into the format needed for the access column.