From 3ca4300cca3acf319fa1462956bd286ea5d73d60 Mon Sep 17 00:00:00 2001
From: Ralf Becker
Date: Wed, 7 May 2008 13:15:11 +0000
Subject: [PATCH] Migration LDAP --> SQL
---
addressbook/inc/class.socontacts.inc.php | 11 ++++++-----
addressbook/templates/default/config.tpl | 5 +++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/addressbook/inc/class.socontacts.inc.php b/addressbook/inc/class.socontacts.inc.php
index b79fc5e86f..4bc409d698 100755
--- a/addressbook/inc/class.socontacts.inc.php
+++ b/addressbook/inc/class.socontacts.inc.php
@@ -728,7 +728,7 @@ class socontacts
$start = $n = 0;
$num = 100;
- while (($contacts = $sql_contacts->search(false,false,'n_family,n_given','','',false,'AND',
+ while ($type != 'sql' && ($contacts = $sql_contacts->search(false,false,'n_family,n_given','','',false,'AND',
array($start,$num),$type != 'contacts,accounts' ? array('contact_owner != 0') : false)))
{
// very worse hack, until Ralf finds a better solution
@@ -754,21 +754,21 @@ class socontacts
}
$start += $num;
}
- if ($type == 'contacts,accounts-back') // migrate the accounts to sql
+ if ($type == 'contacts,accounts-back' || $type == 'sql') // migrate the accounts to sql
{
// very worse hack, until Ralf finds a better solution
// when migrating data, we need to bind as global ldap admin account
// and not as currently logged in user
$ldap_contacts->ds = $GLOBALS['egw']->ldap->ldapConnect();
foreach($ldap_contacts->search(false,false,'n_family,n_given','','',false,'AND',
- false,array('owner' => 0)) as $contact)
+ false,$type == 'sql'?null:array('owner' => 0)) as $contact)
{
if ($contact['jpegphoto']) // photo is NOT read by LDAP backend on search, need to do an extra read
{
$contact = $ldap_contacts->read($contact['id']);
}
unset($contact['id']); // ldap uid/account_lid
- if ($contact['account_id'] && ($old = $sql_contacts->read(array('account_id' => $contact['account_id']))))
+ if ($type != 'sql' && $contact['account_id'] && ($old = $sql_contacts->read(array('account_id' => $contact['account_id']))))
{
$contact['id'] = $old['id'];
}
@@ -778,7 +778,8 @@ class socontacts
if (!($err = $sql_contacts->save()))
{
echo ''.$n.': '.$contact['n_fn'].
- ($contact['org_name'] ? ' ('.$contact['org_name'].')' : '')." --> SQL (".lang('User').")
\n";
+ ($contact['org_name'] ? ' ('.$contact['org_name'].')' : '')." --> SQL (".
+ ($contact['owner']?lang('User'):lang('Contact')).")
\n";
}
else
{
diff --git a/addressbook/templates/default/config.tpl b/addressbook/templates/default/config.tpl
index be9016cbec..a82bcd4545 100644
--- a/addressbook/templates/default/config.tpl
+++ b/addressbook/templates/default/config.tpl
@@ -84,7 +84,7 @@
- {lang_Additional_information_about_using_LDAP_as_contact_repository}:
+ {lang_Additional_information_about_using_LDAP_as_contact_repository}:
README
|
@@ -96,7 +96,8 @@
-
+
+