From eef92b5785949fa43ea4bd68db6d04c12f95f586 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 7 May 2008 13:13:23 +0000 Subject: [PATCH] Migration LDAP --> SQL --- addressbook/inc/class.socontacts.inc.php | 11 ++++++----- addressbook/setup/egw_de.lang | 1 + addressbook/setup/egw_en.lang | 1 + addressbook/templates/default/config.tpl | 5 +++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/addressbook/inc/class.socontacts.inc.php b/addressbook/inc/class.socontacts.inc.php index 624f94edb8..38a8f5d7f6 100755 --- a/addressbook/inc/class.socontacts.inc.php +++ b/addressbook/inc/class.socontacts.inc.php @@ -795,7 +795,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 @@ -821,21 +821,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']; } @@ -845,7 +845,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/setup/egw_de.lang b/addressbook/setup/egw_de.lang index 095163d757..d95ad9841a 100644 --- a/addressbook/setup/egw_de.lang +++ b/addressbook/setup/egw_de.lang @@ -101,6 +101,7 @@ contact saved addressbook de Kontakt gespeichert contact settings admin de Kontakt Einstellungen contactform addressbook de Kontaktformular contacts and account contact-data to ldap admin de Kontakte und Kontaktdaten der Benutzer nach LDAP +contacts and account contact-data to sql admin de Kontakte und Kontaktdaten der Benutzer nach SQL contacts to ldap admin de Kontakte nach LDAP contacts to ldap, account contact-data to sql admin de Kontakte nach LDAP, Kontaktdaten der Benutzer nach SQL contains addressbook de beinhaltet diff --git a/addressbook/setup/egw_en.lang b/addressbook/setup/egw_en.lang index e1be0085b9..94759b02c5 100644 --- a/addressbook/setup/egw_en.lang +++ b/addressbook/setup/egw_en.lang @@ -101,6 +101,7 @@ contact saved addressbook en Contact saved contact settings admin en Contact Settings contactform addressbook en Contactform contacts and account contact-data to ldap admin en contacts and account contact-data to LDAP +contacts and account contact-data to sql admin en contacts and account contact-data to SQL contacts to ldap admin en contacts to LDAP contacts to ldap, account contact-data to sql admin en contacts to LDAP, account contact-data to SQL contains addressbook en contains diff --git a/addressbook/templates/default/config.tpl b/addressbook/templates/default/config.tpl index 5e9d54b10a..d28ce290c3 100644 --- a/addressbook/templates/default/config.tpl +++ b/addressbook/templates/default/config.tpl @@ -100,7 +100,7 @@ -  {lang_Additional_information_about_using_LDAP_as_contact_repository}: +  {lang_Additional_information_about_using_LDAP_as_contact_repository}: README @@ -112,7 +112,8 @@ - + +