[turba] Convert contacts from IMP v2.2.7 to Turba v2.1.6/v2.1.7-cvs

k bah kbah at linuxmail.org
Thu Aug 21 17:13:32 UTC 2008


 Hi,

 I have an old Horde installation, from what I see it has IMP v2.2.7. I did not find a Turba dir inside Horde dir, and a recursive grep showed me just help files talking about Turba.
 The table where users are located on the old Horde install is:

mysql> describe imp_addr;
+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| user     | varchar(120) | NO   | PRI |         |       |
| address  | varchar(120) | NO   | PRI |         |       |
| nickname | varchar(255) | YES  |     | NULL    |       |
| fullname | varchar(255) | YES  |     | NULL    |       |
+----------+--------------+------+-----+---------+-------+

 Sample record:
 user: "willijba at domain.org"
 address: "myfriend at hotmail.com"
 nickname: "myfriend <"
 fullname: "My Friend's Name <"

 I need to convert user's address books by demand, so the new database has just the active users. Because of that I will dump that table, and put it on other database, a database I'm using to help migrate users. In that db I will just add this new table, and I will not relate other data on that database with the data from this table "imp_addr". Everytime a user logs in and his/her account will be migrated, I'll search for him on imp_addr table, which will be on this "new database to help me migrate". For each row I find I'll add this user to turba_objects. The field used to find all user address book entries will be "user" from imp_addr.

 My problem is to understand the new table (turba_objects):

| Field                 | Type         | Null | Key | Default | Extra |
+-----------------------+--------------+------+-----+---------+-------+
| object_id             | varchar(32)  | NO   | PRI |         |       |
| owner_id              | varchar(255) | NO   | MUL |         |       |
| object_type           | varchar(255) | NO   |     | Object  |       |
| object_uid            | varchar(255) | YES  |     | NULL    |       |
| object_members        | blob         | YES  |     | NULL    |       |
| object_name           | varchar(255) | YES  |     | NULL    |       |
| object_alias          | varchar(32)  | YES  |     | NULL    |       |
| object_email          | varchar(255) | YES  |     | NULL    |       |
| object_homeaddress    | varchar(255) | YES  |     | NULL    |       |
| object_workaddress    | varchar(255) | YES  |     | NULL    |       |
| object_homephone      | varchar(25)  | YES  |     | NULL    |       |
| object_workphone      | varchar(25)  | YES  |     | NULL    |       |
| object_cellphone      | varchar(25)  | YES  |     | NULL    |       |
| object_fax            | varchar(25)  | YES  |     | NULL    |       |
| object_title          | varchar(255) | YES  |     | NULL    |       |
| object_company        | varchar(255) | YES  |     | NULL    |       |
| object_notes          | text         | YES  |     | NULL    |       |
| object_pgppublickey   | text         | YES  |     | NULL    |       |
| object_smimepublickey | text         | YES  |     | NULL    |       |
| object_freebusyurl    | varchar(255) | YES  |     | NULL    |       |
+-----------------------+--------------+------+-----+---------+-------+

 The only ones I need to worry about are (right?):

| object_id             | varchar(32)  | NO   | PRI |         |       |
| owner_id              | varchar(255) | NO   | MUL |         |       |
| object_type           | varchar(255) | NO   |     | Object  |       |
| object_uid            | varchar(255) | YES  |     | NULL    |       |
| object_members        | blob         | YES  |     | NULL    |       |
| object_name           | varchar(255) | YES  |     | NULL    |       |
| object_alias          | varchar(32)  | YES  |     | NULL    |       |
| object_email          | varchar(255) | YES  |     | NULL    |       |

 How do I map them?:


1)  object_id = ???? 
2) owner_id = uid field given by LDAP, which is "user~domain.tld", so I'll replace "@" with "~" from the "user" field on imp_addr table. Example:

 table imp_addr 
 field user = someuser at domain.org

 I change it to someuser~domain.org and store here
 table turba_objects
 field owner_id = someuser~domain.org

3) object_type: always "Object"?
4) object_uid: ???? (20080821132125. at domain.org = year, mon, dom, hour, minute, second + "." + the domain from someuser at domain.org = the horde user adding an entry to his/her address book)

5) object_members = ????

6) object_name = fill this with the field "fullname" from the imp_addr old table?

7) object_alias = fill this with the field "nickname" from the imp_addr old table?

8) object_email = fill this with the field "address" from the imp_addr old table?


 For users with more than 1 contact, should I just add to the new Turba table a new record or should I find that user on the database, then add him/her? It seems to me I just need to add contacts, one after another, doesn't matter if the last entry is related to other user, because the owner_id field from this new Horde/Turba db takes care of that: all user catalog entries seem to be select by this field, owner_id, doesn't matter if the first is in row 5 and the last in row 1500.

 I use LDAP to authenticate users, so the table "horde_users" on the new Horde database (Horde v3.1.6) is empty. After a user logs in for the first time, which will happen *after* his address book conversion code is executed, an entry on horde_prefs is added. Is that a problem (I mean, to migrate the address book, therefore writing to turba_objects and just after that giving control from my login/migrate php script to Horde/IMP login script, therefore writing to horde_prefs)?

 thanks

=


-- 
Powered by Outblaze


More information about the turba mailing list