fixed account-migration to work with current accounts-class

This commit is contained in:
Ralf Becker 2008-03-06 20:02:30 +00:00
parent 108cb59d3c
commit d36c179645
2 changed files with 7 additions and 8 deletions

View File

@ -77,9 +77,9 @@ if (!is_object($GLOBALS['egw_setup']->db))
$GLOBALS['egw_setup']->loaddb(); $GLOBALS['egw_setup']->loaddb();
} }
// Load configuration values account_repository and auth_type, a setup has not yet done so // Load configuration values account_repository and auth_type, a setup has not yet done so
$GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table,'config_name,config_value', foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table,'config_name,config_value',
array('config_name'=>array('account_repository','auth_type')),__LINE__,__FILE__); "config_name LIKE 'ldap%' OR config_name LIKE 'account_%' OR config_name LIKE '%encryption%' OR config_name='auth_type'",
while(($row = $GLOBALS['egw_setup']->db->row(true))) __LINE__,__FILE__) as $row)
{ {
$GLOBALS['egw_info']['server'][$row['config_name']] = $row['config_value']; $GLOBALS['egw_info']['server'][$row['config_name']] = $row['config_value'];
} }
@ -98,7 +98,7 @@ if (!$_POST['migrate'])
{ {
// fetch and display the accounts of the NOT set $from repository // fetch and display the accounts of the NOT set $from repository
$GLOBALS['egw_info']['server']['account_repository'] = $from; $GLOBALS['egw_info']['server']['account_repository'] = $from;
$GLOBALS['egw_setup']->setup_account_object(); $GLOBALS['egw_setup']->setup_account_object($GLOBALS['egw_info']['server']);
// fetch all users and groups // fetch all users and groups
$accounts = $GLOBALS['egw_setup']->accounts->search(array( $accounts = $GLOBALS['egw_setup']->accounts->search(array(
@ -174,7 +174,7 @@ if (!$_POST['migrate'])
else // do the migration else // do the migration
{ {
$GLOBALS['egw_info']['server']['account_repository'] = $to; $GLOBALS['egw_info']['server']['account_repository'] = $to;
$GLOBALS['egw_setup']->setup_account_object(); $GLOBALS['egw_setup']->setup_account_object($GLOBALS['egw_info']['server']);
$target = strtoupper($to); $target = strtoupper($to);
$accounts =& $_SESSION['all_accounts']; $accounts =& $_SESSION['all_accounts'];

View File

@ -904,10 +904,9 @@
if (!is_object($GLOBALS['egw']->accounts)) $GLOBALS['egw']->accounts = $this->accounts; if (!is_object($GLOBALS['egw']->accounts)) $GLOBALS['egw']->accounts = $this->accounts;
$this->accounts->cache_invalidate(); // the cache is shared for all instances of the class $this->accounts->cache_invalidate(); // the cache is shared for all instances of the class
if(($GLOBALS['egw_info']['server']['account_repository'] == 'ldap') && if($this->accounts->backend instanceof accounts_ldap && !$this->accounts->backend->ds)
!$this->accounts->ds)
{ {
printf("<b>Error: Error connecting to LDAP server %s!</b><br>",$GLOBALS['egw_info']['server']['ldap_host']); printf("<b>Error: Error connecting to LDAP server %s!</b><br>",$config['ldap_host']);
return false; return false;
} }
} }