If a node get's unpublished all link references should be deleted, but they are not deleted. This is a bug in D6 only as it was fixed in the large D7 upgrade path in Upgrade hook_node_insert/update/delete.

We need to backport this patch to D6.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass’s picture

Status: Active » Needs review
FileSize
1.02 KB

Patch attached

hass’s picture

There seems to be no unpublish test. We should write one to verify if this patch works. BUt the test is required for both D6 and D7.

hass’s picture

Don't forget the changelog entry

AlexisWilke’s picture

That looks good while editing a node. However, I'd afraid it won't work in all cases. If you publish / unpublish a node from the admin/content area, is the nodeapi('update') getting called as expected? (it may, I just am not 100% sure that it is on a simple status change like that.)

If that works, then the fix is correct and will function in all cases as long as you don't currently have "broken links". Because the batch won't go and delete links from unpublished nodes with this patch.

Also I agree with your statement, the comments most certainly have the same problem since these can also be published / unpublished.

hass’s picture

The _linkchecker_add_node_links() function will remove the link references no longer in a published node. Every 24h all unused links will be removed. This works in batch() and node_save() both the same way.

hass’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.