[dev] Turba API cleanups

slusarz at horde.org slusarz at horde.org
Tue Mar 6 23:45:19 UTC 2012


Working with the Turba external API the last few weeks, there are some  
fairly brutal method calls and performance issues.  Wondering if we  
can change some of this in time for Horde 5.

Off the top of my head:

* search() is an example of the problems of using parameters with  
default values.  A potential call to search could look like:
   $registry->call('contacts/search', array(null, null, null, null,  
null, array('email')))

(That call may not return anything, but it is perfectly legal).

Not to mention it is difficult to read.  I would suggest that we  
convert to a single array option that uses named keys to identify the  
parameters.  Not only would it make calls easier to read, but there  
would not need to be placeholders for all the non-used parameters in a  
call.

* The import() call should allow a one-stop duplicate-check for  
optimization purposes.  Such that you don't have to first make a call  
for search(), remove the duplicates from your addition list, and then  
call import() again (which does another duplicate check inside of it).  
  Currently this is not possible since import() will fail if it finds  
a duplicate.  Seems to me that the default should be that a duplicate  
is a success - after a call to import() with a duplicate address, the  
contact exists in the addressbook which is what we really care about  
when importing addresses anyway.

* I think it would be nice to have an API call that does a search  
exclusive to email addresses and returns a Horde_Mail_Rfc822_List  
object.  This is the primary use case in IMP (and for the  
contactautocompleter), and would optimize a common query.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list