This patch chages two occurences in "select node like '%%%s%' "
If, for example you use flexinode, this will show fields in flexinode-1 when the taxonomy is assigned to flexinode-10 only!

It leaves me wondering, why those wildcards are there in the first place? Why wold we want this result to be semi-fuzzy?

CommentFileSizeAuthor
#6 taxonomy_nodes.patch5.15 KBBèr Kessels

Comments

dries’s picture

There appears to be a third and a fourth instance of '%%%s%%' in taxonomy.module. Do these need to be udpated as well?

Bèr Kessels’s picture

I found out why there waswildcard srach :).
When one assign one taxonomy to more nodes, it is saved as
nodename1, nodename2 in the table. a %%%s% will return subselects from that table field.

IMO that is bad and hackish code. I am looking into it, for a more robust solution.

For now postpone it :)

Bèr

killes@www.drop.org’s picture

jhriggs’s picture

I don't necessarily think this should be closed as a dup to 6847, as that is taking a completely different approach that I am not sure is needed...at least in the short term. Why don't we just make this solution simple by using a delimiter between the entries. For example, instead of the types being stored as "blog,story,flexinode-1,foo", store it as "|blog|story|flexinode-1|foo". The query then looks for '%|flexinode-1|%' rather than '%flexinode-1%'. The latter, as Ber pointed out, will pick up flexinode-1, flexinode-10, flexinode-12345678, etc. The former will not. The only downside is that the delimiter character is no longer available in node type names.

Attached is a patch that does just this. If it is applied, we may need to alert maintainers of taxonomy-related modules that may be using the nodes field in the vocabulary table.

As a side note, I would like to do the same type of thing for role permissions which is also doing a similar (potentially flawed) LIKE to check for permissions.

jhriggs’s picture

Note that the patch includes the DB update in updates.inc which may need to be changed slightly if this were to get applied to 4.5.

Bèr Kessels’s picture

StatusFileSize
new5.15 KB

The patch got lost during the move ot the servers. Attaching it again.

killes@www.drop.org’s picture