Ticket #48 (closed defect: fixed)
Backlinks action bug: listing of obsolete pages
| Reported by: | dartar | Owned by: | DotMG |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.3.1 |
| Component: | actions | Version: | 1.1.6.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by dartar) (diff)
The backlinks action may list pages that don't "exist" any more, in the sense that they (apparently) still are in the database but without any active version.
Status
coded
Note
This probably affects the backlinks handler too
Ref
http://wikka.jsnx.com/WikkaBugs#hn_Backlinks_LoadPagesLinkingTo
Related comments migrated from WikkaBugs
Backlinks/LoadPagesLinkingTo()
I just discovered that the backlinks action may list pages that don't "exist" any more, in the sense that they (apparently) still are in the database but without any active version (seemingly as a result of a rename action. I added an example on my own page where you can see a supposed backlink from ReleaseNotes (which was replaced by WikkaReleaseNotes).
The cause is apparently in the LoadPagesLinkingTo() method which is used by backlinks action. It currently is implemented like this:
function LoadPagesLinkingTo($tag) { return $this->LoadAll("select from_tag as tag from ".$this->config["table_prefix"]."links where to_tag = '".mysql_real_escape_string($tag)."' order by tag"); }
I think replacing this by:
function LoadPagesLinkingTo($tag) { return $this->LoadAll("select from_tag as tag from ".$this->config["table_prefix"]."links where to_tag = '".mysql_real_escape_string($tag)."' and latest = 'Y' order by tag"); }
might do the trick to avoid deceased pages - but please test! --JavaWoman
It wont do, since the link-table has no latest col ;). But shouldn't the delete-handler delete these links from the table anyway? --NilsLindenberg
Indeed it is the delete handler that is at fault here by not deleting all records from the links table that refer to the (to be) deleted page. This is simple enough to fix (by extending the query a little to match both the "from_tag" and "to_tag" columns) but for a future version to be released with such a fix there should also be an (admin-only) utility to clear left-behind records from the links table that should have been deleted before. --JavaWoman