mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 23:29:31 +01:00
first take on migrating mail accounts from LDAP to SQL (only qmailUser schema)
This commit is contained in:
parent
99bccea0e8
commit
82df2078c8
@ -245,7 +245,7 @@ class emailadmin_smtp_ldap extends emailadmin_smtp
|
||||
|
||||
if (is_numeric($user))
|
||||
{
|
||||
$filter = '(uidnumber='.(int)$_uidnumber.')';
|
||||
$filter = '(uidnumber='.(int)$user.')';
|
||||
}
|
||||
elseif (strpos($user, '@') === false)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ if (!is_object($GLOBALS['egw_setup']->db))
|
||||
}
|
||||
// Load configuration values account_repository and auth_type, as setup has not yet done so
|
||||
foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table,'config_name,config_value',
|
||||
"config_name LIKE 'ldap%' OR config_name LIKE 'account_%' OR config_name LIKE '%encryption%' OR config_name='auth_type'",
|
||||
"config_name LIKE 'ldap%' OR config_name LIKE 'account_%' OR config_name LIKE '%encryption%' OR config_name='auth_type' OR config_name='mail_suffix'",
|
||||
__LINE__,__FILE__) as $row)
|
||||
{
|
||||
$GLOBALS['egw_info']['server'][$row['config_name']] = $row['config_value'];
|
||||
|
@ -195,6 +195,31 @@ class setup_cmd_ldap extends setup_cmd
|
||||
$msg[] = lang('%1 created in %2.',$what,$target);
|
||||
$accounts_created++;
|
||||
|
||||
// check if we need to migrate mail-account
|
||||
// todo sql --> ldap and other schemas
|
||||
if (!$to_ldap && in_array('qmailUser', $account['objectclass']))
|
||||
{
|
||||
if (!isset($emailadmin_ldap))
|
||||
{
|
||||
include_once(EGW_INCLUDE_ROOT.'/emailadmin/inc/class.postfixldap.inc.php');
|
||||
$emailadmin_ldap = new postfixldap();
|
||||
}
|
||||
if (($mailaccount = $emailadmin_ldap->getUserData($account_id)))
|
||||
{
|
||||
echo "<p>".array2string($mailaccount).': ';
|
||||
if (!isset($emailadmin_sql))
|
||||
{
|
||||
$emailadmin_sql = new emailadmin_smtp_sql();
|
||||
}
|
||||
$emailadmin_sql->setUserData($account_id, (array)$mailaccount['mailAlternateAddress'],
|
||||
(array)$mailaccount['mailForwardingAddress'], $mailaccount['deliveryMode'],
|
||||
$mailaccount['accountStatus'], $mailaccount['mailLocalAddress'],
|
||||
$mailaccount['quotaLimit']);
|
||||
echo "mail account migraged<br/>\n";
|
||||
}
|
||||
else echo "<p>No mail account data found for #$account_id $account[account_lid]!</p>\n";
|
||||
}
|
||||
|
||||
// should we run any or some addAccount hooks
|
||||
if ($this->add_account_hook)
|
||||
{
|
||||
@ -334,7 +359,7 @@ class setup_cmd_ldap extends setup_cmd
|
||||
$accounts_obj = $this->accounts_obj($from_ldap);
|
||||
//error_log(__METHOD__."(from_ldap=".array2string($from_ldap).') get_class(accounts_obj->backend)='.get_class($accounts_obj->backend));
|
||||
|
||||
$accounts = $accounts_obj->search(array('type' => 'both'));
|
||||
$accounts = $accounts_obj->search(array('type' => 'both', 'objectclass' => true));
|
||||
|
||||
foreach($accounts as $account_id => &$account)
|
||||
{
|
||||
@ -343,7 +368,7 @@ class setup_cmd_ldap extends setup_cmd
|
||||
unset($account);
|
||||
$account_id = $account['account_id'];
|
||||
}
|
||||
$account = $accounts_obj->read($account_id);
|
||||
$account += $accounts_obj->read($account_id);
|
||||
|
||||
if ($account['account_type'] == 'g')
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user