fix handling of negative groupid's

without this any groups get deleted from the acl table, when updating from 1.0
This commit is contained in:
Lars Kneschke 2006-01-07 16:37:37 +00:00
parent 50222354b8
commit 3eb3b14a7b

View File

@ -99,9 +99,14 @@
} }
if (($all_accounts = $GLOBALS['phpgw']->accounts->search(array('type'=>'both')))) if (($all_accounts = $GLOBALS['phpgw']->accounts->search(array('type'=>'both'))))
{ {
$all_accounts = array_keys($all_accounts); foreach($all_accounts as $key => $value)
$GLOBALS['egw_setup']->oProc->query("DELETE FROM phpgw_acl WHERE acl_account NOT IN (".implode(',',$all_accounts).")",__LINE__,__FILE__); {
$GLOBALS['egw_setup']->oProc->query("DELETE FROM phpgw_acl WHERE acl_appname='phpgw_group' AND acl_location NOT IN ('".implode("','",$all_accounts)."')",__LINE__,__FILE__); // the latest version of the egw api(>1.2.001) is returning negative groupids
// but in the currently updated version of the acl table, the groupids are yet positive
$allaccounts[] = abs($key);
}
$GLOBALS['egw_setup']->oProc->query("DELETE FROM phpgw_acl WHERE acl_account NOT IN (".implode(',',$allaccounts).")",__LINE__,__FILE__);
$GLOBALS['egw_setup']->oProc->query("DELETE FROM phpgw_acl WHERE acl_appname='phpgw_group' AND acl_location NOT IN ('".implode("','",$allaccounts)."')",__LINE__,__FILE__);
} }
$GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.1.002'; $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.1.002';
return $GLOBALS['setup_info']['phpgwapi']['currentver']; return $GLOBALS['setup_info']['phpgwapi']['currentver'];