http://drupal.org/node/130708
Using the mass delete function does not delete alias

Acidfree has a Album Contents admin page, where one can select multiple images, and edit them. One option is to delete the selected images.

This delete operation does not clean up completely - it deletes the pictures, but it leaves all URL Aliases intact. To really delete the image, then one has to go into the URL aliases list and delete the alias, or not use the delete function from acid free, but instead use the Drupal node edit page, which cleans up correctly - it deletes node, as well as the alias.

From the discussion in the Acidfree thread, Acidfree uses node_delete to delete the node. Does drupal do something else, is there some other way to delete a node so that both the node and its alias gets deleted? Or is there some issue in the path module for this specific case? If there is any debugging or things that need to be done, let me know.

Comments

hansrossel’s picture

I 've had the same problem. The node_delete() function indeed does not deletes URL_aliasses, so for every deleted node the alias is still there referring to a node that does not exists anymore.

I could solve it with using:

// Delete all articles aliasses
db_query("DELETE FROM {url_alias} WHERE dst LIKE '%s'", 'articles/%');    

// Or: Delete all aliasses 
db_query("DELETE FROM {url_alias} WHERE src LIKE '%s'", 'node/%');

Greetings,

Hans
www.koba.be

gagarine’s picture

Thanks Hans :)

They are a reason to keep a path for deleted node?

mmachina’s picture

hello hans... where can i place the code above to get the desired effect?

thanks!

- andy