- updated documentation

- add feature to allow apps to choose to be automatic installed on
  updated: $setup_info[$app]['autoinstall'] = {true|'1.x.xxx'};
- run default_records.inc.php (if exists) also for apps without tables,
  as they might need to initialise some stuff
This commit is contained in:
Ralf Becker 2009-05-28 11:33:30 +00:00
parent 88c9aca3f3
commit 6503d6d0cc
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']; $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
$terror = array(); $terror = array();
$terror[] = $setup_info[$appname]; $terror[$appname] = $setup_info[$appname];
if ($setup_info[$appname]['tables']) 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']; $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
$terror = array(); $terror = array();
$terror[] = $setup_info[$appname]; $terror[$appname] = $setup_info[$appname];
if ($setup_info[$appname]['tables']) if ($setup_info[$appname]['tables'])
{ {
@ -173,6 +173,8 @@ if(@get_var('submit',Array('POST')))
} }
else 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'])) if ($GLOBALS['egw_setup']->app_registered($setup_info[$appname]['name']))
{ {
$GLOBALS['egw_setup']->update_app($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']; $app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
$terror = array(); $terror = array();
$terror[] = $setup_info[$appname]; $terror[$appname] = $setup_info[$appname];
$GLOBALS['egw_setup']->process->upgrade($terror,$DEBUG); $GLOBALS['egw_setup']->process->upgrade($terror,$DEBUG);
if ($setup_info[$appname]['tables']) if ($setup_info[$appname]['tables'])

View File

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

File diff suppressed because it is too large Load Diff