forked from extern/egroupware
patch from <tibolist-at-free.fr>:
code logic was wrong and it was using an API method that is also buggy => in file /egw/phpwgapi/inc/class.common.inc.php the method cmp_version_long(). 1) the code logic: it get versions for the current app and for the api from file (app/setup/setup.inc.php) and from DB. it loops over this 2 apps (app, and api), and set a $_current to true or false. this variable value is defined by the last app check in the loop (the API) => then if your API version is up to date, your application version is also. which was wrong for me. Well in the attached file i change the code logic.
This commit is contained in:
parent
b97d8b5eeb
commit
483ad2cec4
@ -1,77 +1,90 @@
|
|||||||
<?php
|
<?php
|
||||||
/**************************************************************************\
|
/**************************************************************************\
|
||||||
* eGroupWare - Admin *
|
* eGroupWare - Admin *
|
||||||
* http://www.egroupware.org *
|
* http://www.egroupware.org *
|
||||||
* This application written by Miles Lott <milos@groupwhere.org> *
|
* This application written by Miles Lott <milos@groupwhere.org> *
|
||||||
* -------------------------------------------- *
|
* 04/27/2005 Fixed by Olivier TITECA-BEAUPORT <oliviert@maphilo.com> *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* -------------------------------------------- *
|
||||||
* under the terms of the GNU General Public License as published by the *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
* under the terms of the GNU General Public License as published by the *
|
||||||
* option) any later version. *
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||||
\**************************************************************************/
|
* option) any later version. *
|
||||||
|
\**************************************************************************/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
/* Check currentapp and API upgrade status */
|
/* Check currentapp and API upgrade status */
|
||||||
|
|
||||||
if($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
|
if($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
|
||||||
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'welcome' &&
|
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'welcome' &&
|
||||||
(isset($GLOBALS['phpgw_info']['server']['checkappversions']) &&
|
(isset($GLOBALS['phpgw_info']['server']['checkappversions']) &&
|
||||||
$GLOBALS['phpgw_info']['server']['checkappversions']))
|
$GLOBALS['phpgw_info']['server']['checkappversions']))
|
||||||
|
{
|
||||||
|
if((isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
|
||||||
|
$GLOBALS['phpgw_info']['user']['apps']['admin']) ||
|
||||||
|
$GLOBALS['phpgw_info']['server']['checkappversions'] == 'All')
|
||||||
{
|
{
|
||||||
if((isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
|
$_returnhtml = array();
|
||||||
$GLOBALS['phpgw_info']['user']['apps']['admin']) ||
|
$app_name = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
||||||
$GLOBALS['phpgw_info']['server']['checkappversions'] == 'All')
|
$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())
|
||||||
{
|
{
|
||||||
$_current = False;
|
$_db_version = $GLOBALS['phpgw']->db->f('app_version');
|
||||||
$app_name = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
$app_name = $GLOBALS['phpgw']->db->f('app_name');
|
||||||
$GLOBALS['phpgw']->db->query("SELECT app_name,app_version FROM phpgw_applications WHERE app_name='$app_name' OR app_name='phpgwapi'",__LINE__,__FILE__);
|
$_versionfile = $GLOBALS['phpgw']->common->get_app_dir($app_name) . '/setup/setup.inc.php';
|
||||||
while($GLOBALS['phpgw']->db->next_record())
|
if(file_exists($_versionfile))
|
||||||
{
|
{
|
||||||
$_db_version = $GLOBALS['phpgw']->db->f('app_version');
|
include($_versionfile);
|
||||||
$app_name = $GLOBALS['phpgw']->db->f('app_name');
|
$_file_version = $setup_info[$app_name]['version'];
|
||||||
$_versionfile = $GLOBALS['phpgw']->common->get_app_dir($app_name) . '/setup/setup.inc.php';
|
unset($setup_info);
|
||||||
if(file_exists($_versionfile))
|
|
||||||
{
|
|
||||||
include($_versionfile);
|
|
||||||
/* echo '<br>' . $_versionfile . ','; */
|
|
||||||
$_file_version = $setup_info[$app_name]['version'];
|
|
||||||
$_app_title = $setup_info[$app_name]['title'];
|
|
||||||
unset($setup_info);
|
|
||||||
|
|
||||||
if($app_name == 'phpgwapi')
|
if(amorethanb($_file_version, $_db_version))
|
||||||
|
{
|
||||||
|
if($app_name == 'phpgwapi' )
|
||||||
{
|
{
|
||||||
$api_str = '<br>' . lang('The API requires an upgrade');
|
$_returnhtml[$app_name] = lang('The API requires an upgrade');
|
||||||
}
|
}
|
||||||
/* echo $app_name . ',' . $_db_version . ',' . $_file_version; */
|
else
|
||||||
if(!$GLOBALS['phpgw']->common->cmp_version_long($_db_version,$_file_version))
|
|
||||||
{
|
{
|
||||||
$_current = True;
|
$_returnhtml[$app_name] = lang('This application requires an upgrade') . ": \n <br/>" . lang('Please run setup to become current') . '.' . "\n";
|
||||||
if($app_name == 'phpgwapi')
|
|
||||||
{
|
|
||||||
$api_str = '<br>' . lang('The API is current');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
unset($_file_version);
|
|
||||||
unset($_app_title);
|
|
||||||
}
|
}
|
||||||
unset($_db_version);
|
else
|
||||||
unset($_versionfile);
|
{
|
||||||
}
|
if($app_name == 'phpgwapi' )
|
||||||
if(!$_current)
|
{
|
||||||
{
|
$_returnhtml[$app_name] = lang('The API is current');
|
||||||
echo '<center>';
|
}
|
||||||
echo $api_str;
|
else
|
||||||
echo '<br>' . lang('This application requires an upgrade') . ':' . "\n";
|
{
|
||||||
echo '<br>' . lang('Please run setup to become current') . '.' . "\n";
|
$_returnhtml[$app_name] = lang('This application is current') . "\n";
|
||||||
echo '</center>';
|
}
|
||||||
|
}
|
||||||
|
unset($_file_version);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo '<center>';
|
// if setup.inc.php do not exist for the app, we assume that the app is current
|
||||||
echo $api_str;
|
if($app_name == 'phpgwapi' )
|
||||||
echo '<br>' . lang('This application is current') . "\n";
|
{
|
||||||
echo '</center>';
|
$_returnhtml[$app_name] = lang('The API is current');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$_returnhtml[$app_name] = lang('This application is current') . "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
unset($_db_version);
|
||||||
|
unset($_versionfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '<center>';
|
||||||
|
foreach ($_returnhtml as $_html)
|
||||||
|
{
|
||||||
|
echo '<br/>'.$_html;
|
||||||
|
}
|
||||||
|
echo '<center/>';
|
||||||
|
unset($_returnhtml);
|
||||||
|
unset($_html);
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user