facilitate downgrade, if supported by "update" scripts: run downgrades automatic

This commit is contained in:
Ralf Becker 2010-09-15 19:10:00 +00:00
parent 86237f991b
commit 699ce1b1a9
2 changed files with 4 additions and 3 deletions

View File

@ -123,7 +123,7 @@ class setup_detection
* 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,$try_downgrade=false)
{
foreach($setup_info as $key => $value)
{
@ -132,7 +132,8 @@ class setup_detection
if(!( (@$value['status'] == 'F') || (@$value['status'] == 'C') ))
{
//if ($setup_info[$key]['currentver'] > $setup_info[$key]['version'])
if($GLOBALS['egw_setup']->amorethanb($value['currentver'],@$value['version']))
if(!$try_downgrade && $GLOBALS['egw_setup']->amorethanb($value['currentver'],@$value['version']) ||
$value['version'] == 'deleted')
{
$setup_info[$key]['status'] = 'V';
}

View File

@ -101,7 +101,7 @@ class setup_process
if($DEBUG) { echo '<br>process->pass(): #' . $i . ' for ' . $method . ' processing' . "\n"; }
/* Check current versions and dependencies */
$setup_info = $GLOBALS['egw_setup']->detection->get_db_versions($setup_info);
$setup_info = $GLOBALS['egw_setup']->detection->compare_versions($setup_info);
$setup_info = $GLOBALS['egw_setup']->detection->compare_versions($setup_info,true);
//_debug_array($setup_info);exit;
$setup_info = $GLOBALS['egw_setup']->detection->check_depends($setup_info);
//if($i==2) { _debug_array($passed);exit; }