[dev] [cvs] commit: ansel/lib Tags.php

Chuck Hagenbuch chuck at horde.org
Thu May 3 01:30:40 UTC 2007


Quoting Michael Rubinsky <mike at theupstairsroom.com>:

>   Modified files:
>     lib                  Tags.php
>   Log:
>   - Ansel_Tags::readTags() should return a tag_id => tag_name hash
>   - Retrieve the datatree table name the correct way.
>   (I know this isn't the best solution for this query since it  
> relies on the fact that we are using a sql based datatree, but:
>   1) I can't think of another way to work this query for the time being
>   2) Currently, SQL is the only available datatree backend in the  
> base Horde code
>   3) Datatree is going away from what I understand so another  
> solution for storing Gallery info will more than likely be SQL  
> based...
>
>   Any other input on this is welcome and appreciated...

I don't think I understand the code in searchTagsById. You seem to be  
joining in a new copy of the tags <-> images relation table for every  
tag id. I guess you're including the image table for future  
permissions checking, but let's simplify that for now since you should  
still only need one copy of it.

I think that these queries will do everything the current ones do, but  
much simpler and faster:

SELECT DISTINCT image_id FROM ansel_images_tags WHERE tag_id IN (' .  
implode(',', $ids)

SELECT DISTINCT gallery_id FROM ansel_galleries_tags WHERE tag_id IN  
(' . implode(',', $ids)

Am I missing something?

-chuck


More information about the dev mailing list