[turba] keep turba in sync with employees DB

Michael Rubinsky mrubinsk at horde.org
Thu Jun 18 17:44:49 UTC 2009


Quoting Andreas Moroder <andreas.moroder at sb-brixen.it>:

>>
>> Turba has methods such search, getContact, replace, and import that  
>> could be used for something like this.  However, if what your doing  
>> is simply updating a few fields of existing contacts, it might be  
>> easier for you to modify the turba_objects table directly. Most of  
>> the fields in the turba_objects table are self explanatory. Some  
>> that might not be include the object_id - a locally unique  
>> identifier, object_uid - a globally unique identifier used mostly  
>> for syncing, owner_id - this is either the username of the owner of  
>> the contact (if not using a shared source) or the id of the share  
>> that represents the address book this contact belongs to,  
>> object_type would always be "Object" for a contact, object_members  
>> is only used when the entry defines a contact group and contains a  
>> serialized hash of the contact ids that it contains.
>>
>> HTH
>>
>> Thanks,
>> mike
>>
> Hello Mike,
>
> when employees quit or new one begin I have to delete or add records  
> from the main address book. This looks a little bit complicated.  
> Probably the  best way would be to delete all the records of this  
> address book and reimport all. Because this entries will never be  
> synched with a phone or so it should not be a problem that they  
> change id.
> I found the import_vcards.php script, but cannot find two things:
>
> - instructions on how to start a php script from the command line
> - a script that deletes the entries of a address book

That's what the API methods are for.  No reason to delete the whole  
address book, why not just delete the contact, add a new one? Look in  
turba/lib/api.php - the _turba_delete() method to remove an entry,  
_turba_import() to add an entry.  You would use _turba_sources()  
and/or _turba_search() if you needed to locate the contact first.

There is admittedly little documentation regarding the API - what we  
have in on the wiki and at http://dev.horde.org.  There are also a few  
blog entries about programming against horde application apis starting  
at http://theupstairsroom.com/65


> Could you tell me where I find both ?
starting a php script from the command line? :~ mrubinsk$  
./script_name.php  or :~ mrubinsk$ path/to/php ./script_name.php
we have no existing script to delete entries via the command line, but  
this is possible via the api methods mentioned above.

Thanks,
mike

--
The Horde Project (www.horde.org)
mrubinsk at horde.org

"Time just hates me. That's why it made me an adult." - Josh Joplin



More information about the turba mailing list