mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
Enable app upgrade status for admins (of all applications)
This commit is contained in:
parent
3459f050ba
commit
7c7d5ba480
56
home.php
56
home.php
@ -109,25 +109,6 @@
|
|||||||
echo parse_navbar();
|
echo parse_navbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['phpgw']->db->query("select app_version from phpgw_applications where app_name='phpgwapi'",__LINE__,__FILE__);
|
|
||||||
if($GLOBALS['phpgw']->db->next_record())
|
|
||||||
{
|
|
||||||
$apiversion = $GLOBALS['phpgw']->db->f('app_version');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$GLOBALS['phpgw']->db->query("select app_version from phpgw_applications where app_name='admin'",__LINE__,__FILE__);
|
|
||||||
$GLOBALS['phpgw']->db->next_record();
|
|
||||||
$apiversion = $GLOBALS['phpgw']->db->f('app_version');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'] > $apiversion)
|
|
||||||
{
|
|
||||||
echo '<p><b>' . lang('You are running a newer version of phpGroupWare than your database is setup for') . '.'
|
|
||||||
. '<br>' . lang('It is recommended that you run setup to upgrade your tables to the current version') . '.'
|
|
||||||
. '</b>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$GLOBALS['phpgw']->translation->add_app('mainscreen');
|
$GLOBALS['phpgw']->translation->add_app('mainscreen');
|
||||||
if (lang('mainscreen_message') != 'mainscreen_message*')
|
if (lang('mainscreen_message') != 'mainscreen_message*')
|
||||||
{
|
{
|
||||||
@ -143,9 +124,9 @@
|
|||||||
$lines = $GLOBALS['phpgw']->network->gethttpsocketfile('http://www.phpgroupware.org/currentversion');
|
$lines = $GLOBALS['phpgw']->network->gethttpsocketfile('http://www.phpgroupware.org/currentversion');
|
||||||
for ($i=0; $i<count($lines); $i++)
|
for ($i=0; $i<count($lines); $i++)
|
||||||
{
|
{
|
||||||
if (ereg("currentversion",$lines[$i]))
|
if (ereg('currentversion',$lines[$i]))
|
||||||
{
|
{
|
||||||
$line_found = explode(":",chop($lines[$i]));
|
$line_found = explode(':',chop($lines[$i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($GLOBALS['phpgw']->common->cmp_version($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'],$line_found[1]))
|
if($GLOBALS['phpgw']->common->cmp_version($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'],$line_found[1]))
|
||||||
@ -153,6 +134,39 @@
|
|||||||
echo '<p>There is a new version of phpGroupWare available. <a href="'
|
echo '<p>There is a new version of phpGroupWare available. <a href="'
|
||||||
. 'http://www.phpgroupware.org">http://www.phpgroupware.org</a>';
|
. 'http://www.phpgroupware.org">http://www.phpgroupware.org</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_found = False;
|
||||||
|
$GLOBALS['phpgw']->db->query("select app_name,app_version from phpgw_applications",__LINE__,__FILE__);
|
||||||
|
while($GLOBALS['phpgw']->db->next_record())
|
||||||
|
{
|
||||||
|
$_found = True;
|
||||||
|
$_db_version = $GLOBALS['phpgw']->db->f('app_version');
|
||||||
|
$_app_name = $GLOBALS['phpgw']->db->f('app_name');
|
||||||
|
$_versionfile = $GLOBALS['phpgw']->common->get_app_dir($_app_name) . '/setup/setup.inc.php';
|
||||||
|
if(file_exists($_versionfile))
|
||||||
|
{
|
||||||
|
include($_versionfile);
|
||||||
|
$_file_version = $setup_info[$_app_name]['version'];
|
||||||
|
$_app_title = $setup_info[$_app_name]['title'];
|
||||||
|
unset($setup_info);
|
||||||
|
|
||||||
|
if($GLOBALS['phpgw']->common->cmp_version_long($_db_version,$_file_version))
|
||||||
|
{
|
||||||
|
$_app_string .= '<br>' . lang($_app_title);
|
||||||
|
}
|
||||||
|
unset($_file_version);
|
||||||
|
unset($_app_title);
|
||||||
|
}
|
||||||
|
unset($_db_version);
|
||||||
|
unset($_versionfile);
|
||||||
|
}
|
||||||
|
if($_found)
|
||||||
|
{
|
||||||
|
echo '<br>' . lang('The following applications require upgrades') . ':' . "\n";
|
||||||
|
echo $_app_string . "\n";
|
||||||
|
echo '<br>' . lang('Please run setup to become current') . '.' . "\n";
|
||||||
|
unset($_app_string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
|
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
|
||||||
|
@ -47,26 +47,63 @@
|
|||||||
var $crypto;
|
var $crypto;
|
||||||
var $debug_info; // An array with debugging info from the API
|
var $debug_info; // An array with debugging info from the API
|
||||||
|
|
||||||
// Compares two Version strings
|
|
||||||
/*!
|
/*!
|
||||||
@functionn cmp_version
|
@function cmp_version
|
||||||
@@abstract Compares two Version strings and return 1 if str2 is newest (bigger version number) than str1
|
@abstract Compares two Version strings and return 1 if str2 is newest (bigger version number) than str1
|
||||||
@@param $str1
|
@discussion This function checks for major version only.
|
||||||
@@param $str2
|
@param $str1
|
||||||
|
@param $str2
|
||||||
*/
|
*/
|
||||||
function cmp_version($str1,$str2)
|
function cmp_version($str1,$str2)
|
||||||
{
|
{
|
||||||
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]*)",$str1,$regs);
|
||||||
ereg("([0-9]+)\.([0-9]+)\.([0-9]+)[a-zA-Z]*([0-9]*)",$str2,$regs2);
|
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++) {
|
for($i=1;$i<5;$i++)
|
||||||
|
{
|
||||||
|
//echo "<br>$regs[$i] - $regs2[$i]";
|
||||||
if($regs2[$i] == $regs[$i])
|
if($regs2[$i] == $regs[$i])
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if($regs2[$i] > $regs[$i])
|
if($regs2[$i] > $regs[$i])
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
else
|
}
|
||||||
if($regs2[$i] < $regs[$i])
|
elseif($regs2[$i] < $regs[$i])
|
||||||
return 0;
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function cmp_version_long
|
||||||
|
@abstract Compares two Version strings and return 1 if str2 is newest (bigger version number) than str1
|
||||||
|
@discussion This function checks all fields. cmp_version() checks release version only.
|
||||||
|
@param $str1
|
||||||
|
@param $str2
|
||||||
|
*/
|
||||||
|
function cmp_version_long($str1,$str2)
|
||||||
|
{
|
||||||
|
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]";
|
||||||
|
for($i=1;$i<6;$i++)
|
||||||
|
{
|
||||||
|
//echo "<br>$regs[$i] - $regs2[$i]";
|
||||||
|
if($regs2[$i] == $regs[$i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if($regs2[$i] > $regs[$i])
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
elseif($regs2[$i] < $regs[$i])
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user