backported r27143 (setup: autoinstall and default records)

This commit is contained in:
Ralf Becker 2009-05-28 11:37:23 +00:00
parent 37c1edcdd9
commit 03f3303836
3 changed files with 676 additions and 619 deletions

View File

@ -127,7 +127,7 @@ if(@get_var('submit',Array('POST')))
{
$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
$terror = array();
$terror[] = $setup_info[$appname];
$terror[$appname] = $setup_info[$appname];
if ($setup_info[$appname]['tables'])
{
@ -162,7 +162,7 @@ if(@get_var('submit',Array('POST')))
{
$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
$terror = array();
$terror[] = $setup_info[$appname];
$terror[$appname] = $setup_info[$appname];
if ($setup_info[$appname]['tables'])
{
@ -173,6 +173,8 @@ if(@get_var('submit',Array('POST')))
}
else
{
// check default_records for apps without tables, they might need some initial work too
$terror = $GLOBALS['egw_setup']->process->default_records($terror,$DEBUG);
if ($GLOBALS['egw_setup']->app_registered($setup_info[$appname]['name']))
{
$GLOBALS['egw_setup']->update_app($setup_info[$appname]['name']);
@ -199,7 +201,7 @@ if(@get_var('submit',Array('POST')))
{
$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
$terror = array();
$terror[] = $setup_info[$appname];
$terror[$appname] = $setup_info[$appname];
$GLOBALS['egw_setup']->process->upgrade($terror,$DEBUG);
if ($setup_info[$appname]['tables'])

View File

@ -6,12 +6,21 @@
* @package setup
* @author Dan Kuykendall <seek3r@phpgroupware.org>
* @author Miles Lott <milos@groupwhere.org>
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
* Class detecting the current installation status of EGroupware
*/
class setup_detection
{
/**
* Get available application versions and data from filesystem
*
* @return array $setup_info
*/
function get_versions()
{
$d = dir(EGW_SERVER_ROOT);
@ -34,7 +43,13 @@ class setup_detection
return $setup_info;
}
function get_db_versions($setup_info='')
/**
* Get versions of installed applications from database
*
* @param array $setup_info
* @return array $setup_info
*/
function get_db_versions($setup_info=null)
{
$tname = Array();
$GLOBALS['egw_setup']->db->Halt_On_Error = 'no';
@ -97,16 +112,17 @@ class setup_detection
return $setup_info;
}
/* app status values:
U Upgrade required/available
R upgrade in pRogress
C upgrade Completed successfully
D Dependency failure
P Post-install dependency failure
F upgrade Failed
V Version mismatch at end of upgrade (Not used, proposed only)
M Missing files at start of upgrade (Not used, proposed only)
*/
/**
* Compare versions from filesystem and database and set status:
* U Upgrade required/available
* R upgrade in pRogress
* C upgrade Completed successfully
* D Dependency failure
* P Post-install dependency failure
* F upgrade Failed
* V Version mismatch at end of upgrade (Not used, proposed only)
* M Missing files at start of upgrade (Not used, proposed only)
*/
function compare_versions($setup_info)
{
foreach($setup_info as $key => $value)
@ -208,10 +224,10 @@ class setup_detection
return $setup_info;
}
/*
Called during the mass upgrade routine (Stage 1) to check for apps
that wish to be excluded from this process.
*/
/**
* Called during the mass upgrade routine (Stage 1) to check for apps
* that wish to be excluded from this process.
*/
function upgrade_exclude($setup_info)
{
foreach($setup_info as $key => $value)
@ -224,6 +240,11 @@ class setup_detection
return $setup_info;
}
/**
* Check if header exists and is up to date
*
* @return int 1=no header.inc.php, 2=no header admin pw, 3=no instances, 4=need upgrade, 10=ok
*/
function check_header()
{
if(!file_exists('../header.inc.php'))
@ -254,6 +275,12 @@ class setup_detection
return '10';
}
/**
* Check if database exists
*
* @param array $setup_info
* @return int 1=no database, 3=empty, 4=need upgrade, 10=complete
*/
function check_db($setup_info='')
{
$setup_info = $setup_info ? $setup_info : $GLOBALS['setup_info'];

File diff suppressed because it is too large Load Diff