Not 100% sure whether this is a bug or whether there is a configuration issue that leads to this problem. I have searched for existing issues, but could not find any

When I delete a term from my vocabulary, I can see that entries in the url_alias table and the menu_links table remain. Afterwards I also get the following error messages:

Setup:
1) modules used: taxonomy_menu and pathauto
2) pathauto has the following url_alias rules configured:

  • Pattern for all work_type paths: project/[catpath-raw]
  • Default path pattern (applies to all vocabularies with blank patterns below): [vocab-raw]/[catpath-raw]

3) taxonomy:

  • one vocabulary named work_type
  • 3 terms at the root level of the vocabulary; tid 1 to 3

4) in the url_alias table I now see 6 entries that are taxonomy related; here I am not sure what the entries 4 through 6 mean and whether they are correct:

  • taxonomy/term/1 -> project/in-house
  • taxonomy/term/2 -> project/around-house
  • taxonomy/term/3 -> project/other
  • taxonomy/term -> taxonomy/term/1
  • taxonomy/term -> taxonomy/term/2
  • taxonomy/term -> taxonomy/term/3

Problem sequence:
The problem occurs if I now delete one of the three terms, e.g. tid 3. The url_alias table entry for "taxonomy/term/3 -> project/other" is correctly deleted, but the entry "taxonomy/term -> taxonomy/term/3" remains!

If I now do a "store" on the page ... I also get the following error message:
user warning: Duplicate entry 'taxonomy/term/2-' for key 2 query: INSERT INTO url_alias (src, dst, language) VALUES ('taxonomy/term/', 'taxonomy/term/2', '') in C:\My_webdev\htdocs\drupal_live\modules\path\path.module on line 112.

Could somebody tell me where these perhaps incorrect url_alias entries come from?

thanks

Comments

pounard’s picture

I'm experiencing exactly the same bug. Taxonomy menu does not delete url aliases nor menu_links on rebuild, on my box it's kinda random, I can't reproduce the bug, but right now, during a cache clear, it did happen, my menu has all entries * 3, no idea why.

To fix, I have no other choice than, do these SQL queries:

delete from url_alias where src in (select link_path from menu_links where menu_name = 'menu-main-menu');
delete from menu_links where menu_name = 'menu-main-menu';
delete from taxonomy_menu;

Then clear my cache, and let taxonomy_menu rebuild itself.
EDIT: Ah, and then submit vocabulary edit form so taxonomy menu really rebuild the menu.

indytechcook’s picture

Status: Active » Closed (won't fix)

Taxonomy menu doesn't create the alias either. The alias should be deleted when the term is deleted by the pathauto module. From your example, it almost looks like pathauto created incorrect alaises.

There are several bugs fixed in 2.4-rc1 where menu links were not being deleted correctly that might help.

Then clear my cache, and let taxonomy_menu rebuild itself.

This is because it's not really a cache, but I recently learned how to create a rebuilt cache function that hooks into the core Drupal rebuild functions. It's a good idea to add it.

pounard’s picture

This is because it's not really a cache, but I recently learned how to create a rebuilt cache function that hooks into the core Drupal rebuild functions. It's a good idea to add it.

Yes that's why I edited my post, I know that taxonomy menu does not rebuilt itself on cache clear.

The fact is the bug still exists, I still have all my menu entries * 3, may be that's because I do a wrong API usage, I manually call the _taxonomy_menu_rebuild($vid) method at the end of a heavy taxonomy alteration process.

EDIT: did not see your note about 2.4rc1 version, I can't install it on productions sites while it's still unstable. I'll test someday on development instances.

Re EDIT: I should have said I have the bug with 2.3 version (in case you might want to fix it).

Re re EDIT: typo errors.