After installing Taxonomy Manager, my client managed to create a cycle in the term hierarchy for his vocabulary that caused another module to go into an infinite loop whenever displaying a page that also displayed all the terms from that vocabulary (when adding a new node, for example). The Taxonomy module and all modules that depended on it needed to be temporarily disabled to regain control of our site.
Taxonomy Manager needs to detect when an operation will create a cycle in the hierarchy graph and prevent it from occurring. (Other modules that walk taxonomy hierarchy graphs may need to detect this condition as well, but I will postpone posting to those queues until I have a solution for this.)
I am working right now on a short stand-alone Perl program that can connect to the database and detect this condition for our particular site. Once I'm satisfied that it's working, I can convert it to PHP and integrate it into the module.
Comments
Comment #1
mh86 CreditAttribution: mh86 commentedHi!
Since the D6 version of the Taxonomy Manager, a cycle detection is integrated.
See function taxonomy_manager_check_circular_hierarchy in taxonomy_manager.admin.inc
You can easily backport this by copying the function to your D5 version and by adding the validations.
Comment #2
lsiden CreditAttribution: lsiden commentedThanks. Where can I find the definition for taxonomy_manager_form_add_validate() for v2.2?
$ grep -R add_validate *
taxonomy_manager.admin.inc: '#validate' => array('taxonomy_manager_form_add_validate'),
Comment #3
mh86 CreditAttribution: mh86 commentedyou can take a look at taxonomy_manager_form_move_validate:
Comment #4
lsiden CreditAttribution: lsiden commentedI saw the definition for ..._move_validate(), but the form array-hash also references 'taxonomy_manager_form_add_validate()', yet I can't find a definition for ..._add_validate().
$ grep -R _add_validate *
taxonomy_manager.admin.inc: '#validate' => array('taxonomy_manager_form_add_validate'),
What happens when ..._add_validate() gets called? Where does the call go?
Comment #5
mh86 CreditAttribution: mh86 commented_add_validate() has no validation for cycles, because this function only adds new terms (optional assigns them to parents) and I see no possibility of creating cycles with new terms
Comment #6
mh86 CreditAttribution: mh86 commentedah, taxonomy_manager_form_add_validate is missing. now I get it. There is no need for extra validation when adding new terms, but this #validate entry shouldn't exist at all
Comment #7
lsiden CreditAttribution: lsiden commentedBut where is _add_validate() ___DEFINED___???
Comment #8
mh86 CreditAttribution: mh86 commentedAlthough it is defined in the form array, the function for _add_validate doesn't exist. The form API doesn't throw an error, but the definition in the form array shouldn't be there.
Comment #9
lsiden CreditAttribution: lsiden commentedThen it might be a good idea to delete "_add_validate" in the form-array in upcoming releases to avoid confusion.
Thank you for getting back to me.
Comment #10
ivnish CreditAttribution: ivnish commented