From b68f289d87bc2e6b58539146393041996a679970 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 27 Aug 2004 10:41:57 +0000 Subject: [PATCH] made the update strategy of setup_process a bit more flexible: update dont need to be in order in the tables_update file any more: if the next update is not the one we need, we search for the right one and start again from there. This is needed to be able to import phpGW versions from after the fork and it simplyfies the update-scripts a lot now. --- phpgwapi/inc/class.setup_process.inc.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.setup_process.inc.php b/phpgwapi/inc/class.setup_process.inc.php index 079c5ecdab..7a12738df4 100644 --- a/phpgwapi/inc/class.setup_process.inc.php +++ b/phpgwapi/inc/class.setup_process.inc.php @@ -643,7 +643,7 @@ @reset($test); while(list($x,$value) = @each($test)) { - $currentver = $setup_info[$key]['currentver']; + $this->currentversion = $currentver = $setup_info[$key]['currentver']; /* build upgrade function name */ $function = $appname . '_upgrade' . str_replace(".", '_', $value); @@ -718,6 +718,16 @@ $GLOBALS['phpgw_setup']->register_app($appname); $GLOBALS['phpgw_setup']->register_hooks($appname); } + // is the next update the one we need? + if ($success && $test[$x+1] != $success && + ($num = array_search($success,$test)) !== False) + { + // do we have the needed update somewhere else in the row? + // if yes, position the array-pointer just before that update and continue + reset($test); + while((list($x,$value) = each($test)) && $x < $num-1); + continue; + } } else { @@ -737,6 +747,17 @@ if($DEBUG) { echo '
process->upgrade(): running baseline delta only: ' . $function . '...'; } $GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly = True; $success = $function(); + + // is the next update the one we need? + if ($success && $test[$x+1] != $success && + ($num = array_search($success,$test)) !== False) + { + // do we have the needed update somewhere else in the row? + // if yes, position the array-pointer just before that update and continue + reset($test); + while((list($x,$value) = each($test)) && $x < $num-1); + continue; + } } else {