taxonomy_check_vocabulary_hierarchy() is horribly inefficient as it calls taxonomy_get_tree() in order to check the parents.
Also, it seems that the only reason $changed_term is needed is because of the static caching in taxonomy_get_tree().
The job taxonomy_check_vocabulary_hierarchy() could be better solved by a couple of queries, which would also remove the need for $changed_term.
Patch coming up...
Comments
Comment #1
gielfeldt CreditAttribution: gielfeldt commentedComment #2
c960657 CreditAttribution: c960657 commentedThis is a great improvement.
I wonder if it is better/more efficient to use '<>' here?
A few style issues:
The naming of $has_parents and $multiple_parents is inconsistent wrt the has_ prefix.
First the variables $has_parents and $multiple_parents contain a query object, but then they are overwritten by the result of the query. Reusing variables in this way is not good for readability.
Comment #3
gielfeldt CreditAttribution: gielfeldt commentedCan't say if it makes a difference, but I guess it can't hurt to be as explicit as possible to the db-engine.
Of course. A bit sloppy :-). I'll fix.
Comment #4
alchemist_ua CreditAttribution: alchemist_ua commentedHere it is the backport of this to drupal 6.x.
Comment #5
alchemist_ua CreditAttribution: alchemist_ua commentedComment #6
alchemist_ua CreditAttribution: alchemist_ua commentedComment #7
klonos...coming from #353775-59: Vocabulary edit form resets the 'hierarchy' (D7) field to '0' and 'relations' field (D6) to '1'
Does this qualify for a backport to D7 too besides D6?
Comment #8
gielfeldt CreditAttribution: gielfeldt commentedYes, this issue is also relevant for D7.
Comment #9
klonos...thought so ;)
Comment #10
gielfeldt CreditAttribution: gielfeldt commentedAnybody interested in fixing the point mentioned in #3 ?
Comment #15
p-neyens CreditAttribution: p-neyens at Sopra Steria commentedBackport for D7.