Hi guys,
I would like to implement a way to list all pathfilter links to a node upon delete, in order to maintain link integrity. I'd like your opinion on how it would make sense to implement it, as well as any offers to help. In terms of high-level architecture, the following are methods I'm considering.
1. Maintain a table of filters.
Upon updating a page, put all filters on that page into a database table, performing lookups for that node ID when a list is requested.
Pros: Efficient.
Cons: Integrity is lost if a page is updated by other means than through Drupal, for example by changing the database.
2. SELECT matching pages at delete-time.
When a user is going to delete a page, query the database for all pages containing filters to that node.
Pros: Always up to date.
Cons: Inefficient; a full-text search on a whole database. Depending on the size of the site, and frequency of deletions, this may be okay in some cases.
My idea
I think the way to go could be a mix of those two methods. A table 'pathfilter' could exist with the columns 'nid' (node ID of the page within which the link is contained) and 'lid' (node ID of the node being linked to). Together, 'nid' and 'lid' would form a uniqueness relationship.
This table would be updated for each individual 'nid' upon update of that node. A user that changes the database directly should know when the database has been changed in that manner, so I think it'd be reasonable not to make a cron job for this. Such a user would be able to run a script from the admin panel that synchronises the table with node content manually using a full-text search.
A problem shared is a problem solved, so I'm dumping this here for community input before I commence work. I'm not too familiar with the Drupal society and its philosophies, so I'd like the more knowledgeable ones to advise me on this. I intend to work on this over the weekend, so please submit any comments before that time.
Regards,
Oval
Comments
Comment #1
mrfelton commentedI'm not really sure this should be a part of pathfilter - it's seems a little outside the scope of an input filter. It appears the linkchecker module can already be used to identify broken links, and has support for Pathfilter style links.