[turba] Turba fields

Kevin Druff kevin at druffs.com
Wed Aug 3 18:50:12 PDT 2005


Well, that only works if he is comfortable with PHP... I think LOAD DATA
INFILE will work much easier. With a 50,000 record list, you can simply open
it up in Excel and create new columns for uid and the other fields. You
could even create fake data for those columns using RAND function in
Excel...

KD

Kevin Druff
MySQL Database Administrator
Tim Kaine for Governor
www.kaine2005.org 
(804) 673-2100x2258
 
-----Original Message-----
From: turba-bounces at lists.horde.org [mailto:turba-bounces at lists.horde.org]
On Behalf Of Scott Greenberg
Sent: Wednesday, August 03, 2005 9:41 PM
To: turba at lists.horde.org
Subject: Re: [turba] Turba fields

As far as I can tell the uid is used only for logging and api. In the 
case where
you may manual add contacts to database while bypassing Horde, no logging is
preformed. This is a non-issue. For daily use of the address book it could
be
anything you want, even null.  Please note in my last msg, I left out @ in
the
uid field.  The correct creation of uid using sql driver is listed bellow:

$uid = date('YmdHis') . '.' . substr(base_convert(microtime(), 10, 36), -16)
.
'@' . $GLOBALS['conf']['server']['name'];


Kevin, in your case I would do the following, working on MySQL server
machine:
-Create a php script
-Read contacts from a file or database
-Appends each contact with a user, id, & uid, where uid uses main server
name
(again, note this is only for logging purposes and will not effect the use
of
address book)
-Create insert statement for each contact
-Execute inserts using php or MySQL console app

-- 
Scott Greenberg
me at gogogadgetscott.info
GoGoGadgetScott.info


Quoting Kevin Konowalec <kevin.konowalec at ualberta.ca>:

> Hi Scott,
>
> Thanks for the code!  So I have 50,000 addressbooks... I can 
> concatenate them all into a single file with the form "userid, name, 
> address"... but then how do I use this code to run the one-time 
> import?  Where would it hook into turba and how would I run it?  If I 
> have 4 servers front-ending horde with a single machine running mySql 
> on the backend does it matter if I use the same server name for all 
> of the entries or should I randomly set the server name for each 
> userid?
>
> Thanks!
>
> Kevin
>
>
>
> On Aug 2, 2005, at 9:12 PM, Scott Greenberg wrote:
>
>> Both object_id and object_uid are created when adding a new turba object
>> (contact).  The initialization varers based on the turba driver.  
>> Below I have
>> listed info for the sql driver.  If you are using another option refer to
>> ./turba/lib/Driver/*.php > function _makeKey, id is the same in all
cases.
>>
>> <?php
>> if (!isset($GLOBALS['conf']['server']['name'])) {
>>     $GLOBALS['conf']['server']['name'] = $_SERVER['SERVER_NAME'];
>> }
>>
>> $user = 'user';
>>
>> $contacts = array(
>>     array('Test1', 'test1 at none.net'),
>>     array('Test2', 'test2 at none.net'),
>>     array('Test3', 'test3 at none.net')
>>     );
>>
>> foreach ($contacts as $contact) {
>>
>>     $id = md5(uniqid(mt_rand(), true));
>>
>>     $uid = date('YmdHis') . '.' . substr(base_convert(microtime(), 10,
>> 36), -16)
>> . $GLOBALS['conf']['server']['name'];
>>
>>     $sql = "INSERT INTO `turba_objects` (`object_id` , `owner_id` ,
>> `object_type` , `object_uid` , `object_members` , `object_name` ,
>> `object_alias` , `object_email`) VALUES ('$id', '$user', 'Object',
'$uid',
>> NULL, '$contact[0]', '', '$contact[1]');";
>>
>>     echo $sql . "\n";
>> }
>> ?>
>>
>>
>> -- 
>> Scott Greenberg
>> me at gogogadgetscott.info
>> GoGoGadgetScott.info
>>
>>
>> Quoting Kevin Konowalec <kevin at ualberta.net>:
>>
>>> Awesome!  That should work nicely!
>>>
>>> Now all I need to know is what to do with the object_id and
>>> object_uid fields and we'll be in business.....
>>>
>>> Thanks Kevin!
>>>
>>>
>>> On Aug 2, 2005, at 12:01 PM, Kevin Druff wrote:
>>>
>>>> http://dev.mysql.com/doc/mysql/en/load-data.html
>>>>
>>>> Kevin Druff
>>>> MySQL Database Administrator
>>>> Tim Kaine for Governor
>>>> www.kaine2005.org
>>>> (804) 673-2100x2258
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: turba-bounces at lists.horde.org [mailto:turba-
>>>> bounces at lists.horde.org]
>>>> On Behalf Of Kevin Konowalec
>>>> Sent: Tuesday, August 02, 2005 1:55 PM
>>>> To: turba at lists.horde.org
>>>> Subject: [turba] Turba fields
>>>>
>>>> I've been trying to figure out how to do a mass (50,000+ users)
>>>> import of addressbooks from our existing system over to turba.
>>>> Supposedly there are mysql scripts out there that will do this but I
>>>> can't seem to find any of them.  So I started looking into how to do
>>>> it myself but I found that there are 2 fields, object_id and
>>>> object_uid, that are generated by the server somehow and I'm not sure
>>>> what to do about them.  Do I ignore them and just load up the table
>>>> with entries or do I somehow have to generate them?
>>>>
>>>> If anyone has the mysql scripts that could be used for this task, or
>>>> has any insight into how to mass import to mysql from csv files
>>>> please let me know.
>>>>
>>>> Thanks.
>>>> --
>>>> Turba mailing list - Join the hunt: http://horde.org/bounties/#turba
>>>> Frequently Asked Questions: http://horde.org/faq/
>>>> To unsubscribe, mail: turba-unsubscribe at lists.horde.org
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> Turba mailing list - Join the hunt: http://horde.org/bounties/#turba
>>> Frequently Asked Questions: http://horde.org/faq/
>>> To unsubscribe, mail: turba-unsubscribe at lists.horde.org
>>>
>>
>>
>>
>> ----------------------------------------------------------------
>> This message was sent using IMP, the Internet Messaging Program.
>> Powered by SEG Technology hosting.
>>
>> -- 
>> Turba mailing list - Join the hunt: http://horde.org/bounties/#turba
>> Frequently Asked Questions: http://horde.org/faq/
>> To unsubscribe, mail: turba-unsubscribe at lists.horde.org
>>
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Powered by SEG Technology hosting.

-- 
Turba mailing list - Join the hunt: http://horde.org/bounties/#turba
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: turba-unsubscribe at lists.horde.org




More information about the turba mailing list