I noticed that when a weblink node is deleted that the link URL associated with that node continues to appear in the links database. Shouldn't the link be removed from the links table when the we delete a weblink in order to keep the links table from getting cluttered up? I looked through the code of the links_weblinks.module and I found the following:

/**
 * Implementation of hook_delete().
 */
function links_weblink_delete(&$node) {
  // Delete the values from a node that is being erased
  // Don't care if it's "supposed" to have links -- delete if found anyway
  links_weblink_node_build($node);
  links_delete_links_for_node($node, 'links_weblink');
}

I believe there is a bug somewhere preventing the link from being deleted from the links table. Maybe it is getting deleted from the links_node table but not the links table. I hope we can get this fixed soon.

Comments

syscrusher’s picture

The row in {links_node} should always be deleted if the node is deleted. However, the row in {links} will be deleted only if no other references exist to it in {links_node}. Could you please check to see if this is the situation with the node in question, and let me know? Thanks.

Syscrusher

FatPitchFinancials’s picture

I just ran a test of the situation you described. I created a new weblink. I checked {links_node} and it was assigned lid = 19, nid = 13, and module = 'links_weblink'.

Then I navigated to node 13. I deleted that node and then went back to check on the tables.

In {links_node} lid 19, nid 13 was deleted. However, in {links} lid 19 remains. The lid 19 remains in the {links} table even after the weblink node was deleted. The bug is confirmed and will lead to large amounts of unused rows over time in an actively changing weblinks directory.

Thank you for following up on my bug report.

syscrusher’s picture

Assigned: Unassigned » syscrusher

Okay, thanks for the testing. I'm going to call this a confirmed bug based on your results, and will get it fixed in the next release.

Thanks also for the patch on the other issue!

Syscrusher

goldlilys’s picture

When will the next release be? I hope this bug gets fixed soon as well as the warning: Invalid argument supplied for foreach() in /drupal/sites/all/modules/links/links.inc on line 1063 error. Subscribing.